# PlatformDataTransferItem

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

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

```rust
struct PlatformDataTransferItem
```

The base of the synchronous data transfer items of the platform
backends: caches the formats and only asks for the values of supported
formats.

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

## Members

- [`new`](#function-new)
- [`create`](#function-create)
- [`formats`](#function-formats)
- [`try_formats`](#function-try_formats)
- [`contains`](#function-contains)
- [`try_get_raw`](#function-try_get_raw)
- [`try_get_raw_result`](#function-try_get_raw_result)

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

### new

```rust
fn new(platform_impl: impl PlatformDataTransferItemImpl + 'static) -> Rc<PlatformDataTransferItem>
```

Creates the item for a backend implementation.

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

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

### create

```rust
fn create<T: 'static>(format: &DataFormatOf<T>, value: T) -> Rc<PlatformDataTransferItem>
```

Creates an item with a single format and its value.

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

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

### formats

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

Gets the formats supported by this item.
## Panics
Panics if the backend fails to provide them (where the reference
throws from the property); `try_formats` reports the
failure instead.

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

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

### try_formats

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

Gets the formats supported by this item, or the failure of the
backend providing them.

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

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

### contains

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

Gets whether the item supports a specific format.

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

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

### try_get_raw

```rust
fn try_get_raw(self: &Self, format: &DataFormat) -> Option<Rc<dyn Any>>
```

Tries to get a value for a given format. Returns `None` if the
format is not supported.
## Panics
Panics if the backend fails to provide the formats or the value
(where the reference throws);
`try_get_raw_result` reports the failure
instead.

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

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

### try_get_raw_result

```rust
fn try_get_raw_result(self: &Self, format: &DataFormat) -> Result<Option<Rc<dyn Any>>, ClipboardError>
```

Tries to get a value for a given format: `None` if the format is not
supported, or the failure of the backend providing the formats or
the value.

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

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`AsyncDataTransferItemExtensions`](/docs/0.5.0/api/ferroui-base/input/trait-asyncdatatransferitemextensions/)
- [`DataTransferItemExtensions`](/docs/0.5.0/api/ferroui-base/input/trait-datatransferitemextensions/)
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- `ErasedDestructor`
- `IntoEither`
- [`IDataTransferItem`](/docs/0.5.0/api/ferroui-base/input/trait-idatatransferitem/)
- [`IAsyncDataTransferItem`](/docs/0.5.0/api/ferroui-base/input/trait-iasyncdatatransferitem/)

## Availability

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