[−][src]Function timely::execute::execute_directly
pub fn execute_directly<T, F>(func: F) -> T where
T: Send + 'static,
F: FnOnce(&mut Worker<Thread>) -> T + Send + Sync + 'static,
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)); }) });