Skip to main content

PlatformDataTransfer

Struct PlatformDataTransfer 

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

The base of the synchronous data transfers of the platform backends: caches the formats and the items.

Implementations§

Source§

impl PlatformDataTransfer

Source

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

Creates the data transfer for a backend implementation.

Source

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

Gets the formats supported by the data transfer.

§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 the data transfer, or the failure of the backend providing them.

Source

pub fn are_formats_initialized(&self) -> bool

Whether the formats have been provided by the backend.

Source

pub fn items(&self) -> Rc<[Rc<PlatformDataTransferItem>]>

Gets the items of the data transfer.

§Panics

Panics if the backend fails to provide them (where the reference throws from the property); try_items reports the failure instead.

Source

pub fn try_items( &self, ) -> Result<Rc<[Rc<PlatformDataTransferItem>]>, ClipboardError>

Gets the items of the data transfer, or the failure of the backend providing them.

Source

pub fn are_items_initialized(&self) -> bool

Whether the items have been provided by the backend.

Trait Implementations§

Source§

impl IAsyncDataTransfer for PlatformDataTransfer

Source§

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

Gets the formats supported by the data transfer.
Source§

fn items(&self) -> Rc<[Rc<dyn IAsyncDataTransferItem>]>

Gets a list of IAsyncDataTransferItem contained in this object. Read more
Source§

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

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

fn try_items( &self, ) -> Result<Rc<[Rc<dyn IAsyncDataTransferItem>]>, ClipboardError>

Gets the items of the data transfer, or the failure of the platform that provides them. See try_formats.
Source§

fn as_data_transfer(self: Rc<Self>) -> Option<Rc<dyn IDataTransfer>>

The object as a synchronous data transfer, if it also is one.
Source§

impl IDataTransfer for PlatformDataTransfer

Source§

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

Gets the formats supported by the data transfer.
Source§

fn items(&self) -> Rc<[Rc<dyn IDataTransferItem>]>

Gets a list of IDataTransferItem contained in this object. Read more
Source§

fn as_async_data_transfer(self: Rc<Self>) -> Option<Rc<dyn IAsyncDataTransfer>>

The object as an asynchronous data transfer, if it also is one.
Source§

impl IDisposable for PlatformDataTransfer

Source§

fn dispose(&self)

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> AsyncDataTransferExtensions for I

Source§

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

Gets whether the data transfer supports a specific format.
Source§

fn get_items(&self, format: &DataFormat) -> AsyncDataTransferItems ⓘ

Gets the list of IAsyncDataTransferItem contained in the data transfer, filtered by a given format. Read more
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 data transfer. The future resolves to None if the format is not supported, and to an error if the platform providing the items, their formats or the value fails. Read more
Source§

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

Tries to get multiple values for a given format from the data transfer. The future resolves to None if the format is not supported, and to an error as soon as the platform providing the items, their formats or one of the values fails.
Source§

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

Returns a text, if available, from the data transfer. Read more
Source§

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

Returns a bitmap, if available, from the data transfer. Read more
Source§

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

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

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

Returns the files (or folders), if available, from the data transfer. 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> DataTransferExtensions for I
where I: IDataTransfer + ?Sized,

Source§

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

Gets whether the data transfer supports a specific format.
Source§

fn get_items(&self, format: &DataFormat) -> DataTransferItems ⓘ

Gets the list of IDataTransferItem contained in the data transfer, filtered by a given format. Read more
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 data transfer. Returns None if the format is not supported. Read more
Source§

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

Tries to get multiple values for a given format from the data transfer. Returns None if the format is not supported.
Source§

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

Returns a text, if available, from the data transfer. Read more
Source§

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

Returns a bitmap, if available, from the data transfer. Read more
Source§

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

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

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

Returns the files (or folders), if available, from the data transfer. 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.