pub struct Scope<'scope, 'env: 'scope> { /* private fields */ }Expand description
A scope to submit closures in.
See scope for details.
Implementations§
Methods from Deref<Target = Pool>§
Sourcepub fn set_thread_limits(&self, min: u32, max: u32)
pub fn set_thread_limits(&self, min: u32, max: u32)
Sets the thread limits for the Pool object.
Sourcepub fn submit<F: FnOnce() + Send + 'static>(&self, f: F)
pub fn submit<F: FnOnce() + Send + 'static>(&self, f: F)
Submits a closure to the thread pool.
The closure must be Send + 'static.
Sourcepub fn scope<'env, F>(&self, f: F)
pub fn scope<'env, F>(&self, f: F)
Create a scope for submitting closures.
Within this scope local variables can be sent to the pool thread for execution.
This is possible because scope will wait for all submitted closures to finish before
returning. It also waits for closures submitted to the same Pool from other threads,
not just those submitted within this scope.
Trait Implementations§
Auto Trait Implementations§
impl<'scope, 'env> !UnwindSafe for Scope<'scope, 'env>
impl<'scope, 'env> Freeze for Scope<'scope, 'env>
impl<'scope, 'env> RefUnwindSafe for Scope<'scope, 'env>
impl<'scope, 'env> Send for Scope<'scope, 'env>
impl<'scope, 'env> Sync for Scope<'scope, 'env>
impl<'scope, 'env> Unpin for Scope<'scope, 'env>
impl<'scope, 'env> UnsafeUnpin for Scope<'scope, 'env>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more