# WeakValue

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-base/data/core/enum-weakvalue/

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

```rust
enum WeakValue
```

A reference to a binding source that does not keep it alive.

Objects of the class hierarchy and registered reference (model) types are
held weakly, as the managed implementation holds every source. Plain
values (numbers, strings, value structs) own nothing that could form a
cycle and exist only as the transient box that carries them, so they are
held by value.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/data/core/weak_value.rs#L15)

## Members

- [`Reference`](#variant-reference)
- [`Object`](#variant-object)
- [`Value`](#variant-value)
- [`new`](#function-new)
- [`upgrade`](#function-upgrade)

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

### Reference

```rust
Reference(std::rc::Weak<dyn AnyValue>)
```

A shared model object.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/data/core/weak_value.rs#L17)

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

### Object

```rust
Object(crate::WeakRef<crate::FerroObject>, std::any::TypeId)
```

An object of the class hierarchy and the handle type it was seen as.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/data/core/weak_value.rs#L19)

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

### Value

```rust
Value(crate::BoxedValue)
```

A plain value.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/data/core/weak_value.rs#L21)

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

### new

```rust
fn new(value: &BoxedValue) -> Self
```



[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/data/core/weak_value.rs#L38)

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

### upgrade

```rust
fn upgrade(self: &Self) -> Option<BoxedValue>
```

The source, if it is still alive.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/data/core/weak_value.rs#L50)

## 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>`
- `Any`
- `ToOwned`
- `ErasedDestructor`
- `IntoEither`
- `Clone`
- `PartialEq`

## Availability

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