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
impl PlatformDataTransferItem
Sourcepub fn new(
platform_impl: impl PlatformDataTransferItemImpl + 'static,
) -> Rc<PlatformDataTransferItem>
pub fn new( platform_impl: impl PlatformDataTransferItemImpl + 'static, ) -> Rc<PlatformDataTransferItem>
Creates the item for a backend implementation.
Sourcepub fn create<T: 'static>(
format: &DataFormatOf<T>,
value: T,
) -> Rc<PlatformDataTransferItem>
pub fn create<T: 'static>( format: &DataFormatOf<T>, value: T, ) -> Rc<PlatformDataTransferItem>
Creates an item with a single format and its value.
Sourcepub fn formats(&self) -> Rc<[DataFormat]>
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.
Sourcepub fn try_formats(&self) -> Result<Rc<[DataFormat]>, ClipboardError>
pub fn try_formats(&self) -> Result<Rc<[DataFormat]>, ClipboardError>
Gets the formats supported by this item, or the failure of the backend providing them.
Sourcepub fn contains(&self, format: &DataFormat) -> bool
pub fn contains(&self, format: &DataFormat) -> bool
Gets whether the item supports a specific format.
Sourcepub fn try_get_raw(&self, format: &DataFormat) -> Option<Rc<dyn Any>>
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.
Sourcepub fn try_get_raw_result(
&self,
format: &DataFormat,
) -> Result<Option<Rc<dyn Any>>, ClipboardError>
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
impl IAsyncDataTransferItem for PlatformDataTransferItem
Source§fn formats(&self) -> Rc<[DataFormat]>
fn formats(&self) -> Rc<[DataFormat]>
Source§fn try_formats(&self) -> Result<Rc<[DataFormat]>, ClipboardError>
fn try_formats(&self) -> Result<Rc<[DataFormat]>, ClipboardError>
Source§fn try_get_raw_async(
&self,
format: &DataFormat,
) -> LocalBoxFuture<Result<Option<Rc<dyn Any>>, ClipboardError>>
fn try_get_raw_async( &self, format: &DataFormat, ) -> LocalBoxFuture<Result<Option<Rc<dyn Any>>, ClipboardError>>
None if the format is not supported, and to an error if the
platform providing the value fails. Read moreSource§impl IDataTransferItem for PlatformDataTransferItem
impl IDataTransferItem for PlatformDataTransferItem
Source§fn formats(&self) -> Rc<[DataFormat]>
fn formats(&self) -> Rc<[DataFormat]>
Source§fn try_get_raw(&self, format: &DataFormat) -> Option<Rc<dyn Any>>
fn try_get_raw(&self, format: &DataFormat) -> Option<Rc<dyn Any>>
None if the
format is not supported. Read moreAuto Trait Implementations§
impl !Freeze for PlatformDataTransferItem
impl !RefUnwindSafe for PlatformDataTransferItem
impl !Send for PlatformDataTransferItem
impl !Sync for PlatformDataTransferItem
impl !UnwindSafe for PlatformDataTransferItem
impl Unpin for PlatformDataTransferItem
impl UnsafeUnpin for PlatformDataTransferItem
Blanket Implementations§
Source§impl<I> AsyncDataTransferItemExtensions for Iwhere
I: IAsyncDataTransferItem + ?Sized,
impl<I> AsyncDataTransferItemExtensions for Iwhere
I: IAsyncDataTransferItem + ?Sized,
Source§fn contains(&self, format: &DataFormat) -> bool
fn contains(&self, format: &DataFormat) -> bool
Source§fn try_contains(&self, format: &DataFormat) -> Result<bool, ClipboardError>
fn try_contains(&self, format: &DataFormat) -> Result<bool, ClipboardError>
Source§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>>
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>>
fn try_get_text_async( &self, ) -> LocalBoxFuture<Result<Option<String>, ClipboardError>>
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>>
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>>
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
Source§impl<T> ClassDefaults for Twhere
T: ?Sized,
impl<T> ClassDefaults for Twhere
T: ?Sized,
Source§fn static_constructor()
fn static_constructor()
affects_render, metadata
overrides). Read moreSource§impl<I> DataTransferItemExtensions for Iwhere
I: IDataTransferItem + ?Sized,
impl<I> DataTransferItemExtensions for Iwhere
I: IDataTransferItem + ?Sized,
Source§fn contains(&self, format: &DataFormat) -> bool
fn contains(&self, format: &DataFormat) -> bool
Source§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>
None if the format is not supported.