Skip to main content

Executor

Trait Executor 

Source
pub trait Executor {
    type Args: Arguments;

    // Required method
    fn run_with<S, F, O>(&mut self, stream: &mut S, collect: F) -> Result<()>
       where S: Stream<Self::Args, Output = O>,
             O: 'static,
             F: FnMut(O) -> Result<()>;

    // Provided method
    fn run<S>(&mut self, stream: &mut S) -> Result<Vec<S::Output>>
       where S: Stream<Self::Args> { ... }
}
Expand description

A sequential executor for Streams.

Implementations invoke the operations of a Stream in a structured way (which should be reflected in the associated documentation) and aggregate the results.

Required Associated Types§

Source

type Args: Arguments

The argument collection type for the underlying Stream.

Required Methods§

Source

fn run_with<S, F, O>(&mut self, stream: &mut S, collect: F) -> Result<()>
where S: Stream<Self::Args, Output = O>, O: 'static, F: FnMut(O) -> Result<()>,

Execute a series of operations on stream. As outputs are produced, they will be passed to collect for aggregation.

Since dynamic execution may be long-running, this allows implementations of collect to perform operations like status updates or partial saving of results as they are generated.

See also: Executor::run.

Provided Methods§

Source

fn run<S>(&mut self, stream: &mut S) -> Result<Vec<S::Output>>
where S: Stream<Self::Args>,

Execute a series of operations on stream. The outputs of each operation will be collected in the retuned Vec in-order.

See also: Executor::run_with.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§