Skip to main content

ObserverBase

Struct ObserverBase 

Source
pub struct ObserverBase<T> { /* private fields */ }
Expand description

An observer that enforces the grammar of the notifications on its core (ObserverBase<T>): values reach the core until a terminal notification; the first terminal notification reaches it, and every notification after it is ignored. Disposing the observer stops it the same way.

Implementations§

Source§

impl<T: 'static> ObserverBase<T>

Source

pub fn new(core: impl ObserverCore<T> + 'static) -> Self

An observer of the handlers of core (a subclass of ObserverBase<T> upstream).

Source

pub fn from_fns( on_next_core: impl Fn(T) + 'static, on_error_core: impl Fn(ObservableError) + 'static, on_completed_core: impl Fn() + 'static, ) -> Self

An observer whose handlers are the three functions.

Trait Implementations§

Source§

impl<T> IDisposable for ObserverBase<T>

Source§

fn dispose(&self)

Stops the observer: later notifications are ignored (Dispose).

Source§

impl<T: 'static> IObserver<T> for ObserverBase<T>

Source§

fn on_next(&self, value: T)

Hands the value to the core unless the observer is stopped (OnNext).

Source§

fn on_error(&self, error: ObservableError)

Stops the observer and hands the error to the core, the first time (OnError).

Source§

fn on_completed(&self)

Stops the observer and tells the core, the first time (OnCompleted).

Auto Trait Implementations§

§

impl<T> !Freeze for ObserverBase<T>

§

impl<T> !RefUnwindSafe for ObserverBase<T>

§

impl<T> !Send for ObserverBase<T>

§

impl<T> !Sync for ObserverBase<T>

§

impl<T> !UnwindSafe for ObserverBase<T>

§

impl<T> Unpin for ObserverBase<T>
where Box<dyn ObserverCore<T>>: Unpin,

§

impl<T> UnsafeUnpin for ObserverBase<T>
where Box<dyn ObserverCore<T>>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.