# ClipboardExtensions

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-base/input/platform/trait-clipboardextensions/

**trait** · [`ferroui-base`](/docs/0.5.0/api/ferroui-base/) · v0.5.0

```rust
trait ClipboardExtensions: IClipboard
```

Contains extension methods related to [`IClipboard`](/docs/0.5.0/api/ferroui-base/input/platform/trait-iclipboard/).

Every operation resolves to the [`ClipboardError`](/docs/0.5.0/api/ferroui-base/input/platform/struct-clipboarderror/) of the clipboard or
of the data transfer it reads from, where the reference throws from the
awaited task.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/platform/clipboard_extensions.rs#L25)

## Members

- [`get_data_formats_async`](#function-get_data_formats_async)
- [`try_get_value_async`](#function-try_get_value_async)
- [`try_get_values_async`](#function-try_get_values_async)
- [`set_value_async`](#function-set_value_async)
- [`set_values_async`](#function-set_values_async)
- [`try_get_text_async`](#function-try_get_text_async)
- [`try_get_file_async`](#function-try_get_file_async)
- [`try_get_files_async`](#function-try_get_files_async)
- [`try_get_bitmap_async`](#function-try_get_bitmap_async)
- [`set_text_async`](#function-set_text_async)
- [`set_file_async`](#function-set_file_async)
- [`set_files_async`](#function-set_files_async)
- [`set_bitmap_async`](#function-set_bitmap_async)

<a id="function-get_data_formats_async"></a>

### get_data_formats_async

```rust
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.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/platform/clipboard_extensions.rs#L28)

<a id="function-try_get_value_async"></a>

### try_get_value_async

```rust
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.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/platform/clipboard_extensions.rs#L47)

<a id="function-try_get_values_async"></a>

### try_get_values_async

```rust
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.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/platform/clipboard_extensions.rs#L66)

<a id="function-set_value_async"></a>

### set_value_async

```rust
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.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/platform/clipboard_extensions.rs#L90)

<a id="function-set_values_async"></a>

### set_values_async

```rust
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.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/platform/clipboard_extensions.rs#L111)

<a id="function-try_get_text_async"></a>

### try_get_text_async

```rust
fn try_get_text_async(self: &Self) -> LocalBoxFuture<Result<Option<String>, ClipboardError>>
```

Returns a text, if available, from the clipboard.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/platform/clipboard_extensions.rs#L137)

<a id="function-try_get_file_async"></a>

### try_get_file_async

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

Returns a file (or folder), if available, from the clipboard.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/platform/clipboard_extensions.rs#L142)

<a id="function-try_get_files_async"></a>

### try_get_files_async

```rust
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.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/platform/clipboard_extensions.rs#L147)

<a id="function-try_get_bitmap_async"></a>

### try_get_bitmap_async

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

Returns a bitmap, if available, from the clipboard.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/platform/clipboard_extensions.rs#L152)

<a id="function-set_text_async"></a>

### set_text_async

```rust
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.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/platform/clipboard_extensions.rs#L162)

<a id="function-set_file_async"></a>

### set_file_async

```rust
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.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/platform/clipboard_extensions.rs#L172)

<a id="function-set_files_async"></a>

### set_files_async

```rust
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.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/platform/clipboard_extensions.rs#L182)

<a id="function-set_bitmap_async"></a>

### set_bitmap_async

```rust
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.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/platform/clipboard_extensions.rs#L198)

## Trait implementations

- [`ClipboardExtensions`](/docs/0.5.0/api/ferroui-base/input/platform/trait-clipboardextensions/)

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
