# DirectProperty

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-base/struct-directproperty/

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

```rust
struct DirectProperty<TOwner: ObjectType, T: PropertyValue>
```

A direct property: a property whose value is stored in a field of its
owner and accessed through a getter and an optional setter.

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

## Members

- [`getter`](#function-getter)
- [`setter`](#function-setter)
- [`add_owner`](#function-add_owner)

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

### getter

```rust
fn getter(self: &Self) -> fn(&TOwner) -> T
```

The getter function.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/direct_property.rs#L323)

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

### setter

```rust
fn setter(self: &Self) -> Option<fn(&TOwner, T) -> ()>
```

The setter function, if the property is writable.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/direct_property.rs#L329)

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

### add_owner

```rust
fn add_owner<TNewOwner: ObjectType>(self: &'static Self, getter: fn(&TNewOwner) -> T, setter: Option<fn(&TNewOwner, T) -> ()>, metadata: Option<DirectPropertyMetadata<T>>) -> &'static DirectProperty<TNewOwner, T>
```

Registers the direct property on another class, with accessors for
that class. The new property shares the identity of this one.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Base/direct_property.rs#L335)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- [`Receiver`](/docs/0.5.0/api/ferroui-system/task/oneshot/struct-receiver/)
- `Any`
- `ErasedDestructor`
- `IntoEither`
- `Deref`
- [`TypedProperty`](/docs/0.5.0/api/ferroui-base/trait-typedproperty/)
- [`Registrable`](/docs/0.5.0/api/ferroui-base/trait-registrable/)

## Availability

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