# BindingNotification

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

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

```rust
struct BindingNotification
```

Represents a binding notification that can be a valid binding value, or a
binding or data validation error.

This type is very similar to `BindingValue`,
but where `BindingValue` is used by typed bindings, this type is used to
hold binding and data validation errors in untyped bindings.

A notification has reference semantics: it is shared as
`Rc<BindingNotification>` (which converts to a [`BoxedValue`](/docs/0.5.0/api/ferroui-base/type_alias-boxedvalue/) holding the
notification) and is modified in place.

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

## Members

- [`null`](#function-null)
- [`unset_value`](#function-unset_value)
- [`new`](#function-new)
- [`with_error`](#function-with_error)
- [`with_error_and_fallback`](#function-with_error_and_fallback)
- [`value`](#function-value)
- [`has_value`](#function-has_value)
- [`error`](#function-error)
- [`set_error`](#function-set_error)
- [`error_type`](#function-error_type)
- [`set_error_type`](#function-set_error_type)
- [`extract_value`](#function-extract_value)
- [`update_value`](#function-update_value)
- [`extract_error`](#function-extract_error)
- [`add_error`](#function-add_error)
- [`clear_value`](#function-clear_value)
- [`set_value`](#function-set_value)

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

### null

```rust
fn null() -> Rc<BindingNotification>
```

A binding notification representing the null value.

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

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

### unset_value

```rust
fn unset_value() -> Rc<BindingNotification>
```

A binding notification representing the unset value marker.

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

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

### new

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

Creates a binding notification for a binding value.

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

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

### with_error

```rust
fn with_error(error: BindingError, error_type: BindingErrorType) -> Self
```

Creates a binding notification for a binding error.

Panics if `error_type` is `BindingErrorType::None`.

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

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

### with_error_and_fallback

```rust
fn with_error_and_fallback(error: BindingError, error_type: BindingErrorType, fallback_value: Option<BoxedValue>) -> Self
```

Creates a binding notification for a binding error with a fallback
value.

Panics if `error_type` is `BindingErrorType::None`.

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

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

### value

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

Gets the value that should be passed to the target when
`has_value` is true.

If this is read when `has_value` is false then it returns the unset
value marker.

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

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

### has_value

```rust
fn has_value(self: &Self) -> bool
```

Gets a value indicating whether `value` should be
pushed to the target.

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

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

### error

```rust
fn error(self: &Self) -> Option<BindingError>
```

Gets the error that occurred on the source, if any.

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

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

### set_error

```rust
fn set_error(self: &Self, error: Option<BindingError>)
```

Sets the error that occurred on the source.

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

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

### error_type

```rust
fn error_type(self: &Self) -> BindingErrorType
```

Gets the type of error that `error` represents, if any.

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

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

### set_error_type

```rust
fn set_error_type(self: &Self, error_type: BindingErrorType)
```

Sets the type of error that `error` represents.

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

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

### extract_value

```rust
fn extract_value(o: Option<&BoxedValue>) -> Option<BoxedValue>
```

Gets a value from an untyped value that may be a binding notification.

If `o` is a binding notification then returns the binding
notification's `value`. If not, returns the value
unchanged.

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

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

### update_value

```rust
fn update_value(o: Option<&BoxedValue>, value: Option<&BoxedValue>) -> Option<BoxedValue>
```

Updates the value of an untyped value that may be a binding
notification.

If `o` is a binding notification then sets its value to `value` and
returns the notification; otherwise returns `value`. If `value` is a
binding notification then its value is extracted first.

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

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

### extract_error

```rust
fn extract_error(o: Option<&BoxedValue>) -> Option<BoxedValue>
```

Gets an error from an untyped value that may be a binding
notification.

If `o` is a binding notification then returns the binding
notification's `error` (boxed as a `BindingError`).
If not, returns the value unchanged.

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

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

### add_error

```rust
fn add_error(self: &Self, e: BindingError, error_type: BindingErrorType)
```

Adds an error to the binding notification.

Panics if `error_type` is `BindingErrorType::None`.

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

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

### clear_value

```rust
fn clear_value(self: &Self)
```

Removes the `value` and makes
`has_value` return false.

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

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

### set_value

```rust
fn set_value(self: &Self, value: Option<BoxedValue>)
```

Sets the `value`.

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

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`AnyValue`](/docs/0.5.0/api/ferroui-base/trait-anyvalue/)
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- `ToString`
- `ErasedDestructor`
- `IntoEither`
- `PartialEq`
- `Display`
- `Debug`

## Availability

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