Skip to main content

IntoFlow

Trait IntoFlow 

Source
pub trait IntoFlow {
    // Required method
    fn into_flow(self) -> Flow;
}
Expand description

What a plain callback may answer in place of a Flow.

A callback bound as FnMut(T) -> R with R: IntoFlow may return (), which keeps the source going — so the common |value| { ... } needs no trailing Flow::Continue — or a Flow, which lets it end its own stream. This is what CallbackObserver relies on.

A callback that only diverges, such as |_| unreachable!(), is inferred to return !, which no stable impl can cover: spell its return type out, as |_| -> () { unreachable!() }.

Required Methods§

Source

fn into_flow(self) -> Flow

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl IntoFlow for ()

Implementors§