Skip to main content

Flow

Enum Flow 

Source
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

Source

pub fn is_continue(self) -> bool

Returns whether this is Flow::Continue.

Source

pub fn is_stop(self) -> bool

Returns whether this is Flow::Stop.

Trait Implementations§

Source§

impl Clone for Flow

Source§

fn clone(&self) -> Flow

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Flow

Source§

impl Debug for Flow

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Flow

Source§

impl IntoFlow for Flow

Source§

impl PartialEq for Flow

Source§

fn eq(&self, other: &Flow) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Flow

Auto Trait Implementations§

§

impl Freeze for Flow

§

impl RefUnwindSafe for Flow

§

impl Send for Flow

§

impl Sync for Flow

§

impl Unpin for Flow

§

impl UnsafeUnpin for Flow

§

impl UnwindSafe for Flow

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> MaybeSend for T
where T: Send,

Source§

impl<T> MaybeSync for T
where T: Sync,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.