# Subject

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

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

```rust
struct Subject<T>
```

A subject that hands every notification to the observers subscribed at that moment
(`Subject<T>`). An observer that subscribes after the end receives the end at once. Using a
disposed subject panics, where upstream throws `ObjectDisposedException`.

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

## Members

- [`new`](#function-new)
- [`as_observable`](#function-as_observable)
- [`as_observer`](#function-as_observer)

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

### new

```rust
fn new() -> Rc<Self>
```

A subject without observers.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Reactive/subjects/subject.rs#L119)

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

### as_observable

```rust
fn as_observable(self: &Rc<Self>) -> Rc<dyn IObservable<T>>
```

The subject as the handle of an observable sequence.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Reactive/subjects/subject.rs#L124)

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

### as_observer

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

The subject as an observer.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Reactive/subjects/subject.rs#L129)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`ISubjectHandle<A, B>`](/docs/0.5.0/api/ferroui-reactive/subjects/trait-isubjecthandle/)
- [`ISubject<A, B>`](/docs/0.5.0/api/ferroui-reactive/subjects/trait-isubject/)
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- `Any`
- [`SubscribeGuard<T>`](/docs/0.5.0/api/ferroui-base/reactive/use-subscribeguard/)
- [`IObserver<T>`](/docs/0.5.0/api/ferroui-base/reactive/use-iobserver/)
- [`IObservable<T>`](/docs/0.5.0/api/ferroui-base/reactive/use-iobservable/)
- [`IDisposable`](/docs/0.5.0/api/ferroui-base/reactive/use-idisposable/)
- [`SubjectBase<T>`](/docs/0.5.0/api/ferroui-reactive/subjects/trait-subjectbase/)

## Availability

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