PlatformDataTransferItem
struct · ferroui-base · v0.5.0
struct PlatformDataTransferItem
The base of the synchronous data transfer items of the platform backends: caches the formats and only asks for the values of supported formats.
Members
new
fn new(platform_impl: impl PlatformDataTransferItemImpl + 'static) -> Rc<PlatformDataTransferItem>
Creates the item for a backend implementation.
create
fn create<T: 'static>(format: &DataFormatOf<T>, value: T) -> Rc<PlatformDataTransferItem>
Creates an item with a single format and its value.
formats
fn formats(self: &Self) -> Rc<[DataFormat]>
Gets the formats supported by this item.
Panics
Panics if the backend fails to provide them (where the reference
throws from the property); try_formats reports the
failure instead.
try_formats
fn try_formats(self: &Self) -> Result<Rc<[DataFormat]>, ClipboardError>
Gets the formats supported by this item, or the failure of the backend providing them.
contains
fn contains(self: &Self, format: &DataFormat) -> bool
Gets whether the item supports a specific format.
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.
Panics
Panics if the backend fails to provide the formats or the value
(where the reference throws);
try_get_raw_result reports the failure
instead.
try_get_raw_result
fn try_get_raw_result(self: &Self, format: &DataFormat) -> Result<Option<Rc<dyn Any>>, ClipboardError>
Tries to get a value for a given format: None if the format is not
supported, or the failure of the backend providing the formats or
the value.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeAsyncDataTransferItemExtensionsDataTransferItemExtensionsClassDefaultsBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>AnyErasedDestructorIntoEitherIDataTransferItemIAsyncDataTransferItem
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.