Function timely::execute::execute_directly

source ·
pub fn execute_directly<T, F>(func: F) -> T
where T: Send + 'static, F: FnOnce(&mut Worker<Thread>) -> T + Send + Sync + 'static,
Expand description

Executes a single-threaded timely dataflow computation.

The execute_directly constructs a Worker and directly executes the supplied closure to construct and run a timely dataflow computation. It does not create any worker threads, and simply uses the current thread of control.

The closure may return a result, which will be returned from the computation.


use timely::dataflow::operators::{ToStream, Inspect};

// execute a timely dataflow using three worker threads.
timely::execute_directly(|worker| {
    worker.dataflow::<(),_,_>(|scope| {
               .inspect(|x| println!("seen: {:?}", x));