pub struct Scope<'s> { /* private fields */ }
Expand description
Represents a fork-join scope which can be used to spawn any number of tasks.
Implementations§
source§impl<'s> Scope<'s>
impl<'s> Scope<'s>
pub fn new(scheduler: Option<Arc<Scheduler>>) -> Self
sourcepub fn spawn<F>(&self, func: F)where
F: FnOnce(&Scope<'s>) + Send + 's,
pub fn spawn<F>(&self, func: F)where
F: FnOnce(&Scope<'s>) + Send + 's,
Spawns a job into the fork-join scope self
. This job will execute sometime before
the fork-join scope completes. The job is specified as a closure, and this closure
receives its own reference to self
as argument. This can be used to inject new jobs
into self
.