# IAsyncDataTransfer

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

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

```rust
trait IAsyncDataTransfer: IDisposable
```

Represents an object providing a list of [`IAsyncDataTransferItem`](/docs/0.5.0/api/ferroui-base/input/trait-iasyncdatatransferitem/)
usable by the clipboard.

When an implementation of this interface is put into the clipboard using
`IClipboard::set_data_async`,
it must NOT be disposed by the caller. The system will dispose of it
automatically when it becomes unused.

When an implementation of this interface is returned from the clipboard
via `IClipboard::try_get_data_async`,
it MUST be disposed by the caller.

See `DataTransfer` for the mutable
implementation.

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

## Members

- [`formats`](#function-formats)
- [`items`](#function-items)
- [`try_formats`](#function-try_formats)
- [`try_items`](#function-try_items)
- [`as_data_transfer`](#function-as_data_transfer)

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

### formats

```rust
fn formats(self: &Self) -> Rc<[DataFormat]>
```

Gets the formats supported by the data transfer.

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

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

### items

```rust
fn items(self: &Self) -> Rc<[Rc<dyn IAsyncDataTransferItem>]>
```

Gets a list of `IAsyncDataTransferItem` contained in this object.

Some platforms (such as Windows and X11) may only support a single
data item for all formats except files.

Items returned by this property must stay valid until the data
transfer is disposed.

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

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

### try_formats

```rust
fn try_formats(self: &Self) -> Result<Rc<[DataFormat]>, ClipboardError>
```

Gets the formats supported by the data transfer, or the failure of
the platform that provides them.

`formats` has no way to report a failure (where the
reference throws from the property, it panics); the asynchronous
clipboard operations use this member instead, so that the failure
reaches whoever awaits them. Data transfers whose formats cannot
fail keep the default.

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

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

### try_items

```rust
fn try_items(self: &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](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/input/i_async_data_transfer.rs#L47)

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

### as_data_transfer

```rust
fn as_data_transfer(self: Rc<Self>) -> Option<Rc<dyn IDataTransfer>>
```

The object as a synchronous data transfer, if it also is one.

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

## Trait implementations

- [`IAsyncDataTransfer`](/docs/0.5.0/api/ferroui-base/input/trait-iasyncdatatransfer/)

## Availability

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