Struct crossbeam_utils::scoped::Scope
[−]
[src]
pub struct Scope<'a> { /* fields omitted */ }
Methods
impl<'a> Scope<'a>
[src]
pub fn defer<F>(&self, f: F) where
F: FnOnce() + 'a,
[src]
F: FnOnce() + 'a,
Schedule code to be executed when exiting the scope.
This is akin to having a destructor on the stack, except that it is guaranteed to be run. It is guaranteed that the function is called after all the spawned threads are joined.
pub fn spawn<'s, F, T>(&'s self, f: F) -> ScopedJoinHandle<'a, T> where
'a: 's,
F: FnOnce() -> T + Send + 'a,
T: Send + 'a,
[src]
'a: 's,
F: FnOnce() -> T + Send + 'a,
T: Send + 'a,
Create a scoped thread.
spawn
is similar to the spawn
function in Rust's standard library. The
difference is that this thread is scoped, meaning that it's guaranteed to terminate
before the current stack frame goes away, allowing you to reference the parent stack frame
directly. This is ensured by having the parent thread join on the child thread before the
scope exits.
pub fn builder<'s>(&'s self) -> ScopedThreadBuilder<'s, 'a>
[src]
Generates the base configuration for spawning a scoped thread, from which configuration methods can be chained.
Trait Implementations
impl<'a> Debug for Scope<'a>
[src]
fn fmt(&self, f: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more