pub struct DataTransfer { /* private fields */ }Expand description
A mutable implementation of IDataTransfer and
IAsyncDataTransfer.
While it also implements IAsyncDataTransfer, this type always
returns data synchronously. For advanced usages, consider implementing
IAsyncDataTransfer directly.
Implementations§
Source§impl DataTransfer
impl DataTransfer
Sourcepub fn new() -> Rc<DataTransfer>
pub fn new() -> Rc<DataTransfer>
Creates an empty data transfer.
Sourcepub fn formats(&self) -> Rc<[DataFormat]>
pub fn formats(&self) -> Rc<[DataFormat]>
Gets the formats supported by the items of this object, without duplicates.
Sourcepub fn items(&self) -> Rc<[Rc<DataTransferItem>]>
pub fn items(&self) -> Rc<[Rc<DataTransferItem>]>
Gets a list of DataTransferItem contained in this object.
Sourcepub fn add(&self, item: Rc<DataTransferItem>)
pub fn add(&self, item: Rc<DataTransferItem>)
Adds an existing DataTransferItem to this object.
Trait Implementations§
Source§impl IAsyncDataTransfer for DataTransfer
impl IAsyncDataTransfer for DataTransfer
Source§fn formats(&self) -> Rc<[DataFormat]>
fn formats(&self) -> Rc<[DataFormat]>
Gets the formats supported by the data transfer.
Source§fn items(&self) -> Rc<[Rc<dyn IAsyncDataTransferItem>]>
fn items(&self) -> Rc<[Rc<dyn IAsyncDataTransferItem>]>
Gets a list of
IAsyncDataTransferItem contained in this object. Read moreSource§fn as_data_transfer(self: Rc<Self>) -> Option<Rc<dyn IDataTransfer>>
fn as_data_transfer(self: Rc<Self>) -> Option<Rc<dyn IDataTransfer>>
The object as a synchronous data transfer, if it also is one.
Source§fn try_formats(&self) -> Result<Rc<[DataFormat]>, ClipboardError>
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>
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§impl IDataTransfer for DataTransfer
impl IDataTransfer for DataTransfer
Source§fn formats(&self) -> Rc<[DataFormat]>
fn formats(&self) -> Rc<[DataFormat]>
Gets the formats supported by the data transfer.
Source§fn items(&self) -> Rc<[Rc<dyn IDataTransferItem>]>
fn items(&self) -> Rc<[Rc<dyn IDataTransferItem>]>
Gets a list of
IDataTransferItem contained in this object. Read moreSource§fn as_async_data_transfer(self: Rc<Self>) -> Option<Rc<dyn IAsyncDataTransfer>>
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 DataTransfer
impl IDisposable for DataTransfer
Auto Trait Implementations§
impl !Freeze for DataTransfer
impl !RefUnwindSafe for DataTransfer
impl !Send for DataTransfer
impl !Sync for DataTransfer
impl !UnwindSafe for DataTransfer
impl Unpin for DataTransfer
impl UnsafeUnpin for DataTransfer
Blanket Implementations§
Source§impl<I> AsyncDataTransferExtensions for Iwhere
I: IAsyncDataTransfer + ?Sized,
impl<I> AsyncDataTransferExtensions for Iwhere
I: IAsyncDataTransfer + ?Sized,
Source§fn contains(&self, format: &DataFormat) -> bool
fn contains(&self, format: &DataFormat) -> bool
Gets whether the data transfer supports a specific format.
Source§fn get_items(&self, format: &DataFormat) -> AsyncDataTransferItems ⓘ
fn get_items(&self, format: &DataFormat) -> AsyncDataTransferItems ⓘ
Gets the list of
IAsyncDataTransferItem contained in the data
transfer, filtered by a given format. Read moreSource§fn try_get_value_async<T: Clone + 'static>(
&self,
format: &DataFormatOf<T>,
) -> LocalBoxFuture<Result<Option<T>, ClipboardError>>
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 moreSource§fn try_get_values_async<T: Clone + 'static>(
&self,
format: &DataFormatOf<T>,
) -> LocalBoxFuture<Result<Option<Vec<T>>, ClipboardError>>
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>>
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>>
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>>
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>>
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> ClassDefaults for Twhere
T: ?Sized,
impl<T> ClassDefaults for Twhere
T: ?Sized,
Source§fn static_constructor()
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 moreSource§impl<I> DataTransferExtensions for Iwhere
I: IDataTransfer + ?Sized,
impl<I> DataTransferExtensions for Iwhere
I: IDataTransfer + ?Sized,
Source§fn contains(&self, format: &DataFormat) -> bool
fn contains(&self, format: &DataFormat) -> bool
Gets whether the data transfer supports a specific format.
Source§fn get_items(&self, format: &DataFormat) -> DataTransferItems ⓘ
fn get_items(&self, format: &DataFormat) -> DataTransferItems ⓘ
Gets the list of
IDataTransferItem contained in the data
transfer, filtered by a given format. Read moreSource§fn try_get_value<T: Clone + 'static>(
&self,
format: &DataFormatOf<T>,
) -> Option<T>
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 moreSource§fn try_get_values<T: Clone + 'static>(
&self,
format: &DataFormatOf<T>,
) -> Option<Vec<T>>
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>
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>>
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>>
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>>>
fn try_get_files(&self) -> Option<Vec<Rc<dyn IStorageItem>>>
Returns the files (or folders), if available, from the data
transfer. Read more