Skip to main content

PlatformAsyncDataTransferItem

Struct PlatformAsyncDataTransferItem 

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

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

Implementations§

Source§

impl PlatformAsyncDataTransferItem

Source

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

Creates the item for a backend implementation.

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_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 backend fails to provide the formats or the value.

Trait Implementations§

Source§

impl IAsyncDataTransferItem for PlatformAsyncDataTransferItem

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

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<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.