# ResourceKey

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-base/controls/enum-resourcekey/

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

```rust
enum ResourceKey
```

The key of a resource in a resource dictionary.

The object model this library mirrors uses arbitrary objects with value
equality as keys. The keys used in practice are strings and types (a
control theme is keyed by the type it targets), which get their own cheap
variants; any other hashable value can be used through
`ResourceKey::object`.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/controls/resource_key.rs#L43)

## Members

- [`String`](#variant-string)
- [`Type`](#variant-type)
- [`Object`](#variant-object)
- [`object`](#function-object)
- [`as_str`](#function-as_str)

<a id="variant-string"></a>

### String

```rust
String(std::rc::Rc<str>)
```

A string key.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/controls/resource_key.rs#L45)

<a id="variant-type"></a>

### Type

```rust
Type(&'static crate::TypeInfo)
```

A type key.

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

<a id="variant-object"></a>

### Object

```rust
Object(std::rc::Rc<dyn ResourceKeyObject>)
```

Any other key.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/controls/resource_key.rs#L49)

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

### object

```rust
fn object<T: Eq + Hash + 'static>(value: T) -> Self
```

Creates a key from any hashable value.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/controls/resource_key.rs#L54)

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

### as_str

```rust
fn as_str(self: &Self) -> Option<&str>
```

The key as a string, if it is one.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/controls/resource_key.rs#L59)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`ResourceKeyObject`](/docs/0.5.0/api/ferroui-base/controls/trait-resourcekeyobject/)
- [`PropertyValue`](/docs/0.5.0/api/ferroui-base/trait-propertyvalue/)
- [`AnyValue`](/docs/0.5.0/api/ferroui-base/trait-anyvalue/)
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `Borrow<T>`
- `BorrowMut<T>`
- `CloneToUninit`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- `ToOwned`
- `ToString`
- `ErasedDestructor`
- `IntoEither`
- `Clone`
- `PartialEq`
- `Eq`
- `Hash`
- `Debug`
- `Display`
- `From<&str>`
- `From<String>`
- `From<&'static TypeInfo>`
- `From<&ResourceKey>`

## Availability

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