# BindingChange

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-reactiveui/binding/bindings/struct-bindingchange/

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

```rust
struct BindingChange
```

A value a two-way binding moved, and which side of the binding produced it (`BindingChange`).

A two-way binding's change stream carries both directions, so a subscriber that acted on every
value without knowing where it came from would act twice on its own write. The flag is what
separates an edit from the echo of one.

The value is type-erased, as upstream's `object? Value`: a change from the view model carries
the value written to the view, a change from the view the value written to the view model, and
the two may differ in type. `value_as` reads it back.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/binding/bindings/binding_change.rs#L17)

## Members

- [`value`](#struct_field-value)
- [`from_view_model`](#struct_field-from_view_model)
- [`new`](#function-new)
- [`value_as`](#function-value_as)

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

### value

```rust
value: std::rc::Rc<dyn Any>
```

The value that was written (`Value`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/binding/bindings/binding_change.rs#L19)

<a id="struct_field-from_view_model"></a>

### from_view_model

```rust
from_view_model: bool
```

Whether the view model produced the value, rather than the view (`FromViewModel`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/binding/bindings/binding_change.rs#L21)

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

### new

```rust
fn new<T: 'static>(value: T, from_view_model: bool) -> Self
```

A change of `value`, produced by the view model when `from_view_model` is `true`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/binding/bindings/binding_change.rs#L26)

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

### value_as

```rust
fn value_as<T: 'static>(self: &Self) -> Option<&T>
```

The value, when it is a `T`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.ReactiveUI/binding/bindings/binding_change.rs#L31)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- `Borrow<T>`
- `BorrowMut<T>`
- `CloneToUninit`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- `ToOwned`
- `Clone`
- `Debug`
- [`IObservable<BindingChange>`](/docs/0.5.0/api/ferroui-base/reactive/use-iobservable/)

## Availability

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