# Observer

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-reactive/struct-observer/

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

```rust
struct Observer
```

The factory of observers (`Observer`).

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

## Members

- [`create`](#function-create)
- [`create_with_error`](#function-create_with_error)
- [`create_with_completed`](#function-create_with_completed)
- [`create_all`](#function-create_all)
- [`to_observer`](#function-to_observer)

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

### create

```rust
fn create<T: 'static>(on_next: impl Fn(T) -> () + 'static) -> Rc<dyn IObserver<T>>
```

An observer of values; an error panics (`Create(Action<T>)`).

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

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

### create_with_error

```rust
fn create_with_error<T: 'static>(on_next: impl Fn(T) -> () + 'static, on_error: impl Fn(ObservableError) -> () + 'static) -> Rc<dyn IObserver<T>>
```

An observer of values and errors (`Create(Action<T>, Action<Exception>)`).

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

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

### create_with_completed

```rust
fn create_with_completed<T: 'static>(on_next: impl Fn(T) -> () + 'static, on_completed: impl Fn() -> () + 'static) -> Rc<dyn IObserver<T>>
```

An observer of values and the end; an error panics (`Create(Action<T>, Action)`).

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

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

### create_all

```rust
fn create_all<T: 'static>(on_next: impl Fn(T) -> () + 'static, on_error: impl Fn(ObservableError) -> () + 'static, on_completed: impl Fn() -> () + 'static) -> Rc<dyn IObserver<T>>
```

An observer of all three notifications (`Create(Action<T>, Action<Exception>, Action)`).

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

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

### to_observer

```rust
fn to_observer<T: 'static>(handler: impl Fn(Notification<T>) -> () + 'static) -> Rc<dyn IObserver<T>>
```

An observer that hands each notification, as a value, to `handler` (`ToObserver(Action<Notification<T>>)`).

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

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`

## Availability

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