Skip to main content

PlatformDataTransferItem

Struct PlatformDataTransferItem 

Source
pub struct PlatformDataTransferItem { /* private fields */ }
Expand description

The base of the synchronous data transfer items of the platform backends: caches the formats and only asks for the values of supported formats.

Implementations§

Source§

impl PlatformDataTransferItem

Source

pub fn new( platform_impl: impl PlatformDataTransferItemImpl + 'static, ) -> Rc<PlatformDataTransferItem>

Creates the item for a backend implementation.

Source

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

Creates an item with a single format and its value.

Source

pub fn formats(&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.

Source

pub fn try_formats(&self) -> Result<Rc<[DataFormat]>, ClipboardError>

Gets the formats supported by this item, or the failure of the backend providing them.

Source

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

Gets whether the item supports a specific format.

Source

pub fn try_get_raw(&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.

Source

pub fn try_get_raw_result( &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§

Source§

impl IAsyncDataTransferItem for PlatformDataTransferItem

Source§

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

Gets the formats supported by this item.
Source§

fn try_formats(&self) -> Result<Rc<[DataFormat]>, ClipboardError>

Gets the formats supported by this item, or the failure of the platform that provides them. Read more
Source§

fn try_get_raw_async( &self, format: &DataFormat, ) -> LocalBoxFuture<Result<Option<Rc<dyn Any>>, ClipboardError>>

Tries to get a value for a given format. The future resolves to None if the format is not supported, and to an error if the platform providing the value fails. Read more
Source§

impl IDataTransferItem for PlatformDataTransferItem

Source§

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

Gets the formats supported by this item.
Source§

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

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

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<I> AsyncDataTransferItemExtensions for I

Source§

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

Gets whether the item supports a specific format.
Source§

fn try_contains(&self, format: &DataFormat) -> Result<bool, ClipboardError>

Gets whether the item supports a specific format, or the failure of the platform that provides the formats of the item.
Source§

fn try_get_value_async<T: Clone + 'static>( &self, format: &DataFormatOf<T>, ) -> LocalBoxFuture<Result<Option<T>, ClipboardError>>

Tries to get a value for a given format from the item. The future resolves to None if the format is not supported, and to an error if the platform providing the value fails.
Source§

fn try_get_text_async( &self, ) -> LocalBoxFuture<Result<Option<String>, ClipboardError>>

Returns a text, if available, from the item.
Source§

fn try_get_bitmap_async( &self, ) -> LocalBoxFuture<Result<Option<Rc<Bitmap>>, ClipboardError>>

Returns a bitmap, if available, from the item.
Source§

fn try_get_file_async( &self, ) -> LocalBoxFuture<Result<Option<Rc<dyn IStorageItem>>, ClipboardError>>

Returns a file (or folder), if available, from the item. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ClassDefaults for T
where T: ?Sized,

Source§

fn static_constructor()

The static constructor of a type: work done once per thread, after the properties of the type are registered and before its first instance exists (class handlers, affects_render, metadata overrides). Read more
Source§

impl<I> DataTransferItemExtensions for I

Source§

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

Gets whether the item supports a specific format.
Source§

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

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

fn try_get_text(&self) -> Option<String>

Returns a text, if available, from the item.
Source§

fn try_get_bitmap(&self) -> Option<Rc<Bitmap>>

Returns a bitmap, if available, from the item.
Source§

fn try_get_file(&self) -> Option<Rc<dyn IStorageItem>>

Returns a file (or folder), if available, from the item. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.