# AsyncDataTransferExtensions

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

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

```rust
trait AsyncDataTransferExtensions: IAsyncDataTransfer
```

Contains extension methods for [`IAsyncDataTransfer`](/docs/0.5.0/api/ferroui-base/input/trait-iasyncdatatransfer/).

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

## Members

- [`contains`](#function-contains)
- [`get_items`](#function-get_items)
- [`try_get_value_async`](#function-try_get_value_async)
- [`try_get_values_async`](#function-try_get_values_async)
- [`try_get_text_async`](#function-try_get_text_async)
- [`try_get_bitmap_async`](#function-try_get_bitmap_async)
- [`try_get_file_async`](#function-try_get_file_async)
- [`try_get_files_async`](#function-try_get_files_async)

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

### contains

```rust
fn contains(self: &Self, format: &DataFormat) -> bool
```

Gets whether the data transfer supports a specific format.

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

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

### get_items

```rust
fn get_items(self: &Self, format: &DataFormat) -> AsyncDataTransferItems
```

Gets the list of `IAsyncDataTransferItem` contained in the data
transfer, filtered by a given format.

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

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

<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 data transfer. The
future resolves to `None` if the format is not supported, and to an
error if the platform providing the items, their formats or the
value fails.

If the data transfer 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/async_data_transfer_extensions.rs#L96)

<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 data
transfer. The future resolves to `None` if the format is not
supported, and to an error as soon as the platform providing the
items, their formats or one of the values fails.

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

<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 data transfer.

If the data transfer contains several items supporting
`DataFormat::text`, the first matching one will be returned.

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

<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 data transfer.

If the data transfer contains several items supporting
`DataFormat::bitmap`, the first matching one will be returned.

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

<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 data transfer.

See `DataFormat::file`.

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

<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 data
transfer.

See `DataFormat::file`.

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

## Trait implementations

- [`AsyncDataTransferExtensions`](/docs/0.5.0/api/ferroui-base/input/trait-asyncdatatransferextensions/)

## Availability

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