ClipboardExtensions
trait · ferroui-base · v0.5.0
trait ClipboardExtensions: IClipboard
Contains extension methods related to IClipboard.
Every operation resolves to the ClipboardError of the clipboard or
of the data transfer it reads from, where the reference throws from the
awaited task.
Members
get_data_formats_asynctry_get_value_asynctry_get_values_asyncset_value_asyncset_values_asynctry_get_text_asynctry_get_file_asynctry_get_files_asynctry_get_bitmap_asyncset_text_asyncset_file_asyncset_files_asyncset_bitmap_async
get_data_formats_async
fn get_data_formats_async(self: &Self) -> LocalBoxFuture<Result<Rc<[DataFormat]>, ClipboardError>>
Returns a list containing the formats currently available from the clipboard. It is empty if the clipboard is empty.
try_get_value_async
fn try_get_value_async<T: Clone + 'static>(self: &Self, format: &DataFormatOf<T>) -> LocalBoxFuture<Result<Option<T>, ClipboardError>>
Tries to get a value for a given format from the clipboard. The
future resolves to None if the format is not supported.
If the clipboard contains several items supporting the format, the first matching one will be returned.
try_get_values_async
fn try_get_values_async<T: Clone + 'static>(self: &Self, format: &DataFormatOf<T>) -> LocalBoxFuture<Result<Option<Vec<T>>, ClipboardError>>
Tries to get multiple values for a given format from the clipboard.
The future resolves to None if the format is not supported.
set_value_async
fn set_value_async<T: 'static>(self: &Self, format: &DataFormatOf<T>, value: Option<T>) -> LocalBoxFuture<Result<(), ClipboardError>>
Places a single value on the clipboard in the specified format.
By calling this method, the clipboard will be instantly cleared, and data will be lazily requested later when it is pasted.
If value is None, nothing will be placed on the clipboard and it
will be cleared instead.
set_values_async
fn set_values_async<T: 'static>(self: &Self, format: &DataFormatOf<T>, values: Option<impl IntoIterator<Item = T>>) -> LocalBoxFuture<Result<(), ClipboardError>>
where Self: Sized
Places multiple values on the clipboard in the specified format.
By calling this method, the clipboard will be instantly cleared, and data will be lazily requested later when it is pasted.
If values is None or empty, nothing will be placed on the
clipboard and it will be cleared instead.
try_get_text_async
fn try_get_text_async(self: &Self) -> LocalBoxFuture<Result<Option<String>, ClipboardError>>
Returns a text, if available, from the clipboard.
try_get_file_async
fn try_get_file_async(self: &Self) -> LocalBoxFuture<Result<Option<Rc<dyn IStorageItem>>, ClipboardError>>
Returns a file (or folder), if available, from the clipboard.
try_get_files_async
fn try_get_files_async(self: &Self) -> LocalBoxFuture<Result<Option<Vec<Rc<dyn IStorageItem>>>, ClipboardError>>
Returns the files (or folders), if available, from the clipboard.
try_get_bitmap_async
fn try_get_bitmap_async(self: &Self) -> LocalBoxFuture<Result<Option<Rc<Bitmap>>, ClipboardError>>
Returns a bitmap, if available, from the clipboard.
set_text_async
fn set_text_async(self: &Self, text: Option<&str>) -> LocalBoxFuture<Result<(), ClipboardError>>
Places a text on the clipboard.
By calling this method, the clipboard will be instantly cleared.
If text is None, nothing will be placed on the clipboard and it
will be cleared instead.
set_file_async
fn set_file_async(self: &Self, file: Option<Rc<dyn IStorageItem>>) -> LocalBoxFuture<Result<(), ClipboardError>>
Places a file (or folder) on the clipboard.
By calling this method, the clipboard will be instantly cleared.
If file is None, nothing will be placed on the clipboard and it
will be cleared instead.
set_files_async
fn set_files_async(self: &Self, files: Option<impl IntoIterator<Item = Rc<dyn IStorageItem>>>) -> LocalBoxFuture<Result<(), ClipboardError>>
where Self: Sized
Places a list of files (or folders) on the clipboard.
By calling this method, the clipboard will be instantly cleared.
If files is None or empty, nothing will be placed on the
clipboard and it will be cleared instead.
set_bitmap_async
fn set_bitmap_async(self: &Self, bitmap: Option<Rc<Bitmap>>) -> LocalBoxFuture<Result<(), ClipboardError>>
Places a bitmap on the clipboard.
By calling this method, the clipboard will be instantly cleared.
If bitmap is None, nothing will be placed on the clipboard and
it will be cleared instead.
Trait implementations
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.