Skip to main content

Observer

Trait Observer 

Source
pub trait Observer<T, E> {
    // Required methods
    fn on_next(&mut self, value: T) -> Flow;
    fn on_termination(self, termination: Termination<E>);
}
Expand description

A trait for observing the progress and termination state of an operation.

Required Methods§

Source

fn on_next(&mut self, value: T) -> Flow

Called when the next value in the operation is available.

Returns whether the observer accepts further events. Flow::Stop means it accepts none and must not be terminated either, so the caller stops pushing and drops it; see Flow for the exact promise each variant makes. An operator that forwards values must return what its own downstream returned, so that the answer reaches the source at the end of the chain.

Source

fn on_termination(self, termination: Termination<E>)

Called when the operation has reached its termination state.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T, E, OR, D> Observer<T, E> for AutoDisposeOnTerminationObserver<OR, D>
where OR: Observer<T, E>, D: Disposable,

Source§

impl<T, E, R, FN, FT> Observer<T, E> for CallbackObserver<FN, FT>
where FN: FnMut(T) -> R, R: IntoFlow, FT: FnOnce(Termination<E>),

Source§

impl<T, E> Observer<T, E> for AsyncSubject<'_, T, E>
where T: Clone, E: Clone,

Source§

impl<T, E> Observer<T, E> for BehaviorSubject<'_, T, E>
where T: Clone, E: Clone,

Source§

impl<T, E> Observer<T, E> for BoxedObserver<'_, T, E>

Source§

impl<T, E> Observer<T, E> for PublishSubject<'_, T, E>
where T: Clone, E: Clone,

Source§

impl<T, E> Observer<T, E> for ReplaySubject<'_, T, E>
where T: Clone, E: Clone,

Source§

impl<T, E> Observer<T, E> for UnicastSender<'_, T, E>