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§
Sourcefn on_next(&mut self, value: T) -> Flow
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.
Sourcefn on_termination(self, termination: Termination<E>)
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".