FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    DataTransferItem

    struct · ferroui-base · v0.5.0

    struct DataTransferItem
    

    A mutable implementation of IDataTransferItem and IAsyncDataTransferItem. This type also provides several functions to easily create a DataTransferItem for common usages.

    While it also implements IAsyncDataTransferItem, this type always returns data synchronously. For advanced usages, consider implementing IAsyncDataTransferItem directly.

    View source

    Members

    new

    fn new() -> Rc<DataTransferItem>
    

    Creates an item without any format.

    Source

    formats

    fn formats(self: &Self) -> Rc<[DataFormat]>
    

    Gets the formats supported by this item.

    Source

    contains

    fn contains(self: &Self, format: &DataFormat) -> bool
    

    Gets whether the item supports a specific format.

    Source

    try_get_raw

    fn try_get_raw(self: &Self, format: &DataFormat) -> Option<Rc<dyn Any>>
    

    Tries to get a value for a given format. Returns None if the format is not supported.

    Source

    try_get_value

    fn try_get_value<T: Clone + 'static>(self: &Self, format: &DataFormatOf<T>) -> Option<T>
    

    Tries to get a typed value for a given format.

    Source

    set

    fn set<T: 'static>(self: &Self, format: &DataFormatOf<T>, value: Option<T>)
    

    Sets the value for a given format.

    If value is None, the format won't be part of the item.

    Source

    set_with

    fn set_with<T: 'static>(self: &Self, format: &DataFormatOf<T>, get_value: impl Fn() -> Option<T> + 'static)
    

    Sets a value created on demand for a given format.

    Source

    set_text

    fn set_text(self: &Self, value: Option<&str>)
    

    Sets the value for the DataFormat::text format.

    If value is None, the format won't be part of the item.

    Source

    set_file

    fn set_file(self: &Self, value: Option<Rc<dyn IStorageItem>>)
    

    Sets the value for the DataFormat::file format.

    If value is None, the format won't be part of the item.

    Source

    set_bitmap

    fn set_bitmap(self: &Self, value: Option<Rc<Bitmap>>)
    

    Sets the value for the DataFormat::bitmap format.

    If value is None, the format won't be part of the item.

    Source

    create

    fn create<T: 'static>(format: &DataFormatOf<T>, value: Option<T>) -> Rc<DataTransferItem>
    

    Creates a new item for a single format with a given value.

    If value is None, the format won't be part of the item.

    Source

    create_with

    fn create_with<T: 'static>(format: &DataFormatOf<T>, get_value: impl Fn() -> Option<T> + 'static) -> Rc<DataTransferItem>
    

    Creates a new item for a single format with a given value created on demand.

    Source

    create_text

    fn create_text(value: Option<&str>) -> Rc<DataTransferItem>
    

    Creates a new item with DataFormat::text as a single format.

    If value is None, the format won't be part of the item.

    Source

    create_file

    fn create_file(value: Option<Rc<dyn IStorageItem>>) -> Rc<DataTransferItem>
    

    Creates a new item with DataFormat::file as a single format.

    If value is None, the format won't be part of the item.

    Source

    Trait implementations

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.