# ObserverExt

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-reactive/trait-observerext/

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

```rust
trait ObserverExt<T>
```

The extension methods of `Observer` on an observer (`Observer.Extensions.cs`).

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Reactive/observer.rs#L106)

## Members

- [`to_notifier`](#function-to_notifier)
- [`as_observer`](#function-as_observer)
- [`checked`](#function-checked)
- [`synchronize`](#function-synchronize)
- [`synchronize_prevent_reentrancy`](#function-synchronize_prevent_reentrancy)
- [`synchronize_with_gate`](#function-synchronize_with_gate)
- [`synchronize_with_lock`](#function-synchronize_with_lock)
- [`notify_on`](#function-notify_on)
- [`notify_on_schedule`](#function-notify_on_schedule)
- [`notify_on_context`](#function-notify_on_context)
- [`to_progress`](#function-to_progress)
- [`to_progress_on`](#function-to_progress_on)

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

### to_notifier

```rust
fn to_notifier(self: &Self) -> Box<dyn Fn(Notification<T>) -> ()>
```

The observer as a function of notifications (`ToNotifier`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Reactive/observer.rs#L108)

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

### as_observer

```rust
fn as_observer(self: &Self) -> Rc<dyn IObserver<T>>
```

An observer that hides the identity of this one (`AsObserver`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Reactive/observer.rs#L111)

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

### checked

```rust
fn checked(self: &Self) -> Rc<dyn IObserver<T>>
```

An observer that checks the grammar of the notifications it receives (`Checked`): it panics,
where upstream throws `InvalidOperationException`, on a notification after a terminal one
and on a notification while another is being handled.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Reactive/observer.rs#L116)

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

### synchronize

```rust
fn synchronize(self: &Self) -> Rc<dyn IObserver<T>>
```

An observer whose notifications reach this one under a lock of its own
(`Synchronize(IObserver<T>)`, a `SynchronizedObserver<T>`): it ignores everything after a
terminal notification. On one thread the notifications are serialized already, and the lock
of upstream (a monitor) is re-entrant: a notification that re-enters the observer from
inside another reaches this one at once.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Reactive/observer.rs#L123)

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

### synchronize_prevent_reentrancy

```rust
fn synchronize_prevent_reentrancy(self: &Self, prevent_reentrancy: bool) -> Rc<dyn IObserver<T>>
```

An observer whose notifications reach this one one at a time
(`Synchronize(IObserver<T>, bool preventReentrancy)`): with `prevent_reentrancy`, through an
`AsyncLock` of its own, so that a notification that re-enters the observer from inside
another is queued and reaches this one when that one has returned (`AsyncLockObserver<T>`);
without, as `synchronize`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Reactive/observer.rs#L130)

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

### synchronize_with_gate

```rust
fn synchronize_with_gate(self: &Self, gate: Rc<dyn std::any::Any>) -> Rc<dyn IObserver<T>>
```

An observer whose notifications reach this one under the lock `gate`
(`Synchronize(IObserver<T>, object gate)`), which observers may share; as
`synchronize`, the lock is re-entrant and has nothing to serialize on
one thread. The observer keeps the gate.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Reactive/observer.rs#L136)

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

### synchronize_with_lock

```rust
fn synchronize_with_lock(self: &Self, async_lock: Rc<AsyncLock>) -> Rc<dyn IObserver<T>>
```

An observer whose notifications reach this one through `async_lock`
(`Synchronize(IObserver<T>, AsyncLock)`, an `AsyncLockObserver<T>`), which observers may
share: a notification that arrives while an action of the lock runs (a re-entrant one) is
queued and reaches this one after it.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Reactive/observer.rs#L142)

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

### notify_on

```rust
fn notify_on(self: &Self, scheduler: Rc<dyn crate::concurrency::IScheduler>) -> Rc<dyn IObserver<T>>
```

An observer that delivers the notifications to this one on `scheduler`, in order
(`NotifyOn(IScheduler)`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Reactive/observer.rs#L146)

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

### notify_on_schedule

```rust
fn notify_on_schedule(self: &Self, schedule: std::sync::Arc<dyn ferroui_system::task::Schedule>) -> Rc<dyn IObserver<T>>
```

An observer that delivers the notifications to this one through `schedule`, in order
(`NotifyOn(SynchronizationContext)`: the observer of `NotifyOn(IScheduler)` on a
`SynchronizationContextScheduler` of
the schedule, which posts with
`schedule_local`: the observer is notified
on the thread of the schedule).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Reactive/observer.rs#L154)

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

### notify_on_context

```rust
fn notify_on_context(self: &Self, context: std::sync::Arc<dyn ferroui_system::threading::SynchronizationContext>) -> Rc<dyn IObserver<T>>
```

An observer that delivers the notifications to this one through `context`, in order
(`NotifyOn(SynchronizationContext)`: the observer of `NotifyOn(IScheduler)` on a
`SynchronizationContextScheduler` of
the context, which posts with `post_local`: the observer is notified on the thread of the
context).

> **Deprecated since 0.5.0.** use `notify_on_schedule` with a `ferroui_system::task::Schedule`

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Reactive/observer.rs#L165)

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

### to_progress

```rust
fn to_progress(self: &Self) -> Rc<dyn IProgress<T>>
```

A progress object whose reports are the values of this observer (`ToProgress(IObserver<T>)`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Reactive/observer.rs#L168)

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

### to_progress_on

```rust
fn to_progress_on(self: &Self, scheduler: Rc<dyn crate::concurrency::IScheduler>) -> Rc<dyn IProgress<T>>
```

A progress object whose reports reach this observer as values on `scheduler`, in order
(`ToProgress(IObserver<T>, IScheduler)`, through the observer of `ObserveOn`).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Reactive/observer.rs#L172)

## Trait implementations

- [`ObserverExt<T>`](/docs/0.5.0/api/ferroui-reactive/trait-observerext/)

## Availability

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