Skip to main content

Step

Trait Step 

Source
pub trait Step<T, F> {
    type Item;
    type Held;
    type Action: Future;

    // Required methods
    fn start(
        action: F,
        value: T,
        emitter: &mut Option<Emitter<Self::Item>>,
    ) -> (Self::Action, Self::Held);
    fn finish(
        held: Self::Held,
        output: <Self::Action as Future>::Output,
    ) -> Finish<Self::Item>;
}
Expand description

How one suspending operator calls its action and what it emits.

Each suspending operator of FlowExt is a Suspending flow with its own step: Mapping, Filtering, FilterMapping, Inspecting, Transforming or TransformingWhile.

Required Associated Types§

Source

type Item

What the operator emits.

Source

type Held

What the operator keeps while the action runs.

Source

type Action: Future

The action’s future.

Required Methods§

Source

fn start( action: F, value: T, emitter: &mut Option<Emitter<Self::Item>>, ) -> (Self::Action, Self::Held)

Starts the action for value. emitter is created on first use by the steps that emit from inside their action.

Source

fn finish( held: Self::Held, output: <Self::Action as Future>::Output, ) -> Finish<Self::Item>

Decides what the finished action means downstream.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl<T, F, Fut> Step<T, F> for Mapping
where F: FnOnce(T) -> Fut, Fut: Future,

Source§

type Item = <Fut as Future>::Output

Source§

type Held = ()

Source§

type Action = Fut

Source§

impl<T, U, F, Fut> Step<T, F> for FilterMapping
where F: FnOnce(T) -> Fut, Fut: Future<Output = Option<U>>,

Source§

type Item = U

Source§

type Held = ()

Source§

type Action = Fut

Source§

impl<T, U, V, F, Fut> Step<T, F> for Emitting<U, V>
where V: Verdict, F: FnOnce(T, Emitter<U>) -> Fut, Fut: Future<Output = V>,

Source§

type Item = U

Source§

type Held = ()

Source§

type Action = Fut

Source§

impl<T, V, F, Fut> Step<T, F> for Passing<V>
where T: Clone, V: Verdict, F: FnOnce(T) -> Fut, Fut: Future<Output = V>,

Source§

type Item = T

Source§

type Held = T

Source§

type Action = Fut

Source§

impl<U, F, Fut> Step<(), F> for EmitterAction<U>
where F: FnOnce(Emitter<U>) -> Fut, Fut: Future<Output = ()>,

Source§

type Item = U

Source§

type Held = ()

Source§

type Action = Fut