Module executors::run_now [−][src]
A simple Executor
that simply runs tasks immediately on the current thread.
This is mostly useful to work with APIs that require an Executor
,
even if “normal” stack-based execution is actually desired.
Examples
Run tasks in order.
use executors::*; use executors::run_now::RunNowExecutor; let exec = RunNowExecutor::new(); exec.execute(|| println!("hello")); exec.execute(|| println!("world")); exec.execute(|| println!("foo")); exec.execute(|| println!("bar")); exec.shutdown();
Note
If you use try_execute_locally from within a job closure, it will be the same as running recursively, so you may run of out stack space, eventually.
Structs
RunNowExecutor | A handle to the run_now executor |