# IClipboard

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

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

```rust
trait IClipboard
```

Represents the system clipboard.

This interface is not meant to be implemented by applications.

Every operation resolves to a [`ClipboardError`](/docs/0.5.0/api/ferroui-base/input/platform/struct-clipboarderror/) when the platform
clipboard fails (where the reference throws from the awaited task).

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

## Members

- [`clear_async`](#function-clear_async)
- [`set_data_async`](#function-set_data_async)
- [`flush_async`](#function-flush_async)
- [`try_get_data_async`](#function-try_get_data_async)
- [`try_get_in_process_data_async`](#function-try_get_in_process_data_async)

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

### clear_async

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

Clears any data from the system clipboard.

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

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

### set_data_async

```rust
fn set_data_async(self: &Self, data_transfer: Option<Rc<dyn IAsyncDataTransfer>>) -> LocalBoxFuture<Result<(), ClipboardError>>
```

Places a data object on the clipboard. The data may be queried
lazily by the system: the data transfer must stay valid until the
clipboard is cleared or replaced. `None` clears the clipboard.

By calling this method, the clipboard will often be instantly
cleared, and data will be lazily requested later when it is pasted.

The data transfer must NOT be disposed by the caller after this
call: the clipboard will dispose of it automatically when it becomes
unused.

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

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

### flush_async

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

Permanently adds the data that is on the clipboard so that it is
available after the data's original application closes.

This method is only supported on the Windows platform; it does
nothing on other platforms.

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

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

### try_get_data_async

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

Retrieves data previously stored on the clipboard.

The returned data transfer MUST be disposed by the caller.

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

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

### try_get_in_process_data_async

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

Retrieves the exact instance of a data transfer previously placed on
the clipboard by `set_data_async`, if any.

This method cannot be used to retrieve a data transfer set by
another process or by the system.

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

## Trait implementations

- [`IClipboard`](/docs/0.5.0/api/ferroui-base/input/platform/trait-iclipboard/)

## Availability

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