Function timely::execute::execute_directly
source · pub fn execute_directly<T, F>(func: F) -> T
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.
§Examples
use timely::dataflow::operators::{ToStream, Inspect};
// execute a timely dataflow using three worker threads.
timely::execute_directly(|worker| {
worker.dataflow::<(),_,_>(|scope| {
(0..10).to_stream(scope)
.inspect(|x| println!("seen: {:?}", x));
})
});