Struct spawner::Spawner
[−]
[src]
pub struct Spawner { /* fields omitted */ }
A wrapper for thread::spawn
that optionally auto-joins threads.
Methods
impl Spawner
[src]
fn new() -> Spawner
Create a new Spawner object
fn spawn_collected<F>(&mut self, f: F) where
F: FnOnce(),
F: Send + 'static,
F: FnOnce(),
F: Send + 'static,
Spawn a thread that will be auto-joined when the Spawner is dropped
The thread function should be a move closure returning ()
fn spawn<F, T>(&mut self, f: F) -> JoinHandle<T> where
F: FnOnce() -> T,
F: Send + 'static,
T: Send + 'static,
F: FnOnce() -> T,
F: Send + 'static,
T: Send + 'static,
Spawn a thread that won't be auto-joined
The thread function should be a move closure