# DataTransferExtensions

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

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

```rust
trait DataTransferExtensions: IDataTransfer
```

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

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

## Members

- [`contains`](#function-contains)
- [`get_items`](#function-get_items)
- [`try_get_value`](#function-try_get_value)
- [`try_get_values`](#function-try_get_values)
- [`try_get_text`](#function-try_get_text)
- [`try_get_bitmap`](#function-try_get_bitmap)
- [`try_get_file`](#function-try_get_file)
- [`try_get_files`](#function-try_get_files)

<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/data_transfer_extensions.rs#L33)

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

### get_items

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

Gets the list of `IDataTransferItem` 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/data_transfer_extensions.rs#L42)

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

### try_get_value

```rust
fn try_get_value<T: Clone + 'static>(self: &Self, format: &DataFormatOf<T>) -> Option<T>
```

Tries to get a value for a given format from the data transfer.
Returns `None` if the format is not supported.

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/data_transfer_extensions.rs#L51)

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

### try_get_values

```rust
fn try_get_values<T: Clone + 'static>(self: &Self, format: &DataFormatOf<T>) -> Option<Vec<T>>
```

Tries to get multiple values for a given format from the data
transfer. Returns `None` if the format is not supported.

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

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

### try_get_text

```rust
fn try_get_text(self: &Self) -> Option<String>
```

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/data_transfer_extensions.rs#L72)

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

### try_get_bitmap

```rust
fn try_get_bitmap(self: &Self) -> Option<Rc<Bitmap>>
```

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/data_transfer_extensions.rs#L80)

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

### try_get_file

```rust
fn try_get_file(self: &Self) -> Option<Rc<dyn IStorageItem>>
```

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/data_transfer_extensions.rs#L87)

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

### try_get_files

```rust
fn try_get_files(self: &Self) -> Option<Vec<Rc<dyn IStorageItem>>>
```

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/data_transfer_extensions.rs#L95)

## Trait implementations

- [`DataTransferExtensions`](/docs/0.5.0/api/ferroui-base/input/trait-datatransferextensions/)

## Availability

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