# ToPropertyMixins

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-reactiveui/binding/mixins/trait-topropertymixins/

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

```rust
trait ToPropertyMixins<T: Clone + PartialEq + 'static>
```

`ToProperty`: makes an [`ObservableAsPropertyHelper`](/docs/0.5.0/api/ferroui-reactiveui/binding/bindings/struct-observableaspropertyhelper/) that follows the sequence and raises the
change notifications of a property of its owner; implemented for `Rc<dyn IObservable<T>>`.

The property is named by a path (`prop!(VM => full_name)`), whose name is the one raised. The
helper raises `PropertyChanging` and `PropertyChanged` through
`IReactiveObject`'s raising methods, so the suppression and the delay
of the notifications apply. The owner is held weakly.

Upstream's forms with an `out` parameter return the helper as the other forms do, so they are
these; a view model stores the helper (in a `OnceCell` or a `RefCell<Option<..>>`) and reads
`value` in its getter.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/binding/mixins/to_property.rs#L24)

## Members

- [`to_property`](#function-to_property)
- [`to_property_deferred`](#function-to_property_deferred)
- [`to_property_on`](#function-to_property_on)
- [`to_property_deferred_on`](#function-to_property_deferred_on)
- [`to_property_with_initial_value`](#function-to_property_with_initial_value)
- [`to_property_with`](#function-to_property_with)
- [`to_property_by_name`](#function-to_property_by_name)

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

### to_property

```rust
fn to_property<VM: IReactiveObject>(self: Self, owner: &Rc<VM>, path: PropertyPath<Rc<VM>, T>) -> ObservableAsPropertyHelper<T>
where T: Default
```

The helper of the property `path` of `owner`, from the default value of `T`
(`ToProperty(TObj, Func<TObj, TRet>)`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/binding/mixins/to_property.rs#L27)

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

### to_property_deferred

```rust
fn to_property_deferred<VM: IReactiveObject>(self: Self, owner: &Rc<VM>, path: PropertyPath<Rc<VM>, T>, defer_subscription: bool) -> ObservableAsPropertyHelper<T>
where T: Default
```

`to_property` that subscribes on the first read of the value when
`defer_subscription` is set (`ToProperty(TObj, Func<TObj, TRet>, bool)`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/binding/mixins/to_property.rs#L33)

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

### to_property_on

```rust
fn to_property_on<VM: IReactiveObject>(self: Self, owner: &Rc<VM>, path: PropertyPath<Rc<VM>, T>, scheduler: Option<Rc<dyn IScheduler>>) -> ObservableAsPropertyHelper<T>
where T: Default
```

`to_property` that delivers the values on `scheduler`
(`ToProperty(TObj, Func<TObj, TRet>, ISequencer?)`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/binding/mixins/to_property.rs#L39)

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

### to_property_deferred_on

```rust
fn to_property_deferred_on<VM: IReactiveObject>(self: Self, owner: &Rc<VM>, path: PropertyPath<Rc<VM>, T>, defer_subscription: bool, scheduler: Option<Rc<dyn IScheduler>>) -> ObservableAsPropertyHelper<T>
where T: Default
```

`to_property` with both options (`ToProperty(TObj, Func<TObj, TRet>,
bool, ISequencer?)`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/binding/mixins/to_property.rs#L45)

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

### to_property_with_initial_value

```rust
fn to_property_with_initial_value<VM: IReactiveObject>(self: Self, owner: &Rc<VM>, path: PropertyPath<Rc<VM>, T>, initial_value: T) -> ObservableAsPropertyHelper<T>
```

The helper starting from `initial_value` (`ToProperty(TObj, Func<TObj, TRet>, TRet)`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/binding/mixins/to_property.rs#L56)

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

### to_property_with

```rust
fn to_property_with<VM: IReactiveObject>(self: Self, owner: &Rc<VM>, path: PropertyPath<Rc<VM>, T>, initial_value: ObservableAsPropertyInitialValue<T>, defer_subscription: bool, scheduler: Option<Rc<dyn IScheduler>>) -> ObservableAsPropertyHelper<T>
```

The helper with every option: the initial value or its factory, the deferred subscription
and the scheduler (the forms with `TRet initialValue` or `Func<TRet> getInitialValue`,
`bool deferSubscription` and `ISequencer? scheduler`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/binding/mixins/to_property.rs#L61)

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

### to_property_by_name

```rust
fn to_property_by_name<VM: IReactiveObject>(self: Self, owner: &Rc<VM>, property_name: &str, initial_value: ObservableAsPropertyInitialValue<T>, defer_subscription: bool, scheduler: Option<Rc<dyn IScheduler>>) -> ObservableAsPropertyHelper<T>
```

The helper of the property named `property_name`, with every option (the forms that name
the property with a string, `nameof(Property)`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/binding/mixins/to_property.rs#L72)

## Trait implementations

- [`ToPropertyMixins<T>`](/docs/0.5.0/api/ferroui-reactiveui/binding/mixins/trait-topropertymixins/)

## Availability

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