Skip to main content

AsyncDataTransferExtensions

Trait AsyncDataTransferExtensions 

Source
pub trait AsyncDataTransferExtensions: IAsyncDataTransfer {
    // Provided methods
    fn contains(&self, format: &DataFormat) -> bool { ... }
    fn get_items(&self, format: &DataFormat) -> AsyncDataTransferItems ⓘ { ... }
    fn try_get_value_async<T: Clone + 'static>(
        &self,
        format: &DataFormatOf<T>,
    ) -> LocalBoxFuture<Result<Option<T>, ClipboardError>> { ... }
    fn try_get_values_async<T: Clone + 'static>(
        &self,
        format: &DataFormatOf<T>,
    ) -> LocalBoxFuture<Result<Option<Vec<T>>, ClipboardError>> { ... }
    fn try_get_text_async(
        &self,
    ) -> LocalBoxFuture<Result<Option<String>, ClipboardError>> { ... }
    fn try_get_bitmap_async(
        &self,
    ) -> LocalBoxFuture<Result<Option<Rc<Bitmap>>, ClipboardError>> { ... }
    fn try_get_file_async(
        &self,
    ) -> LocalBoxFuture<Result<Option<Rc<dyn IStorageItem>>, ClipboardError>> { ... }
    fn try_get_files_async(
        &self,
    ) -> LocalBoxFuture<Result<Option<Vec<Rc<dyn IStorageItem>>>, ClipboardError>> { ... }
}
Expand description

Contains extension methods for IAsyncDataTransfer.

Provided Methods§

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.

Some platforms (such as Windows and X11) may only support a single data item for all formats except files.

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.

If the data transfer contains several items supporting the format, the first matching one will be returned.

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.

If the data transfer contains several items supporting DataFormat::text, the first matching one will be returned.

Source

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

Returns a bitmap, if available, from the data transfer.

If the data transfer contains several items supporting DataFormat::bitmap, the first matching one will be returned.

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.

See DataFormat::file.

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.

See DataFormat::file.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§