pub enum Flow {
Continue,
Stop,
}Expand description
Whether an observer still accepts events, as reported by Observer::on_next.
This is the only way an observer can tell the source that is pushing into it to stop, while
that push is running. It matters most for a synchronous source, which delivers its whole
sequence before subscribe returns: until it does, nobody holds the subscription yet, so
disposing it is not yet possible, and an infinite synchronous source would never end.
It does not replace disposal, and no source may rely on it alone: an observer can also go away between two events, which no return value can report. See the variants for what each one promises.
Variants§
Continue
The observer is not known to have stopped, so the source may keep pushing.
This is a hint, not a guarantee: it means “no stop has been observed here”, and the
observer may still be disposed before the next event, or already have been disposed
somewhere this call could not see — a value queued behind a delivery running elsewhere is
reported as Continue even when that delivery is about to stop. A source must therefore
still honor its disposal; treating Continue as proof that downstream is alive is wrong.
Stop
The observer will never accept another event.
The caller must not call Observer::on_next again, must not call
Observer::on_termination, and should drop the observer instead: it has either already
delivered its own termination downstream or been disposed, so a termination sent now would
be a second one. Unlike Flow::Continue, this is a guarantee, never a hint.
Implementations§
Source§impl Flow
impl Flow
Sourcepub fn is_continue(self) -> bool
pub fn is_continue(self) -> bool
Returns whether this is Flow::Continue.
Sourcepub fn is_stop(self) -> bool
pub fn is_stop(self) -> bool
Returns whether this is Flow::Stop.