# ResourceHostRef

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

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

```rust
enum ResourceHostRef
```

A strong reference to a resource host: a styled element, or another host
such as the application object.

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

## Members

- [`Element`](#variant-element)
- [`Other`](#variant-other)
- [`downgrade`](#function-downgrade)
- [`as_element`](#function-as_element)
- [`resource_observable`](#function-resource_observable)

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

### Element

```rust
Element(crate::Ref<crate::StyledElement>)
```



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

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

### Other

```rust
Other(std::rc::Rc<dyn IResourceHost>)
```



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

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

### downgrade

```rust
fn downgrade(self: &Self) -> WeakResourceHost
```

Creates a weak reference to the host.

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

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

### as_element

```rust
fn as_element(self: &Self) -> Option<&Ref<StyledElement>>
```

The host as a styled element, if it is one.

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

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

### resource_observable

```rust
fn resource_observable(self: &Self, key: impl Into<ResourceKey>, converter: Option<ResourceConverter>) -> Rc<dyn IObservable<Option<BoxedValue>>>
```

Gets an observable for the resource with the specified key.

The observable produces the current value on subscription and a new
value whenever the resources visible to the host, or its theme
variant, change. It holds the host weakly; while it has observers the
host keeps it alive.

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

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`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>`
- [`Receiver`](/docs/0.5.0/api/ferroui-system/task/oneshot/struct-receiver/)
- `Any`
- `ToOwned`
- `ErasedDestructor`
- `IntoEither`
- `Clone`
- `Deref`
- `PartialEq`
- `From<Ref<T>>`
- `From<&Ref<T>>`
- `From<Rc<dyn IResourceHost>>`
- `From<Rc<T>>`

## Availability

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