pub struct Scope<'scope, 'env: 'scope> { /* private fields */ }Expand description
A scope for spawning concurrent tasks that borrow from the local stack.
All submitted tasks are guaranteed to complete before the scope exits.
Implementations§
Source§impl<'scope, 'env> Scope<'scope, 'env>
impl<'scope, 'env> Scope<'scope, 'env>
Sourcepub fn run<T: 'scope>(&self, task_fn: fn(&T), params: &'scope [T])
pub fn run<T: 'scope>(&self, task_fn: fn(&T), params: &'scope [T])
Submits tasks to the pool within this scope.
Sourcepub fn wait(&self)
pub fn wait(&self)
Waits for all tasks currently submitted to this scope to complete.
Can be called multiple times to synchronize between phases of work.
Sourcepub fn is_complete(&self) -> bool
pub fn is_complete(&self) -> bool
Checks if all submitted tasks have finished.
Auto Trait Implementations§
impl<'scope, 'env> !Freeze for Scope<'scope, 'env>
impl<'scope, 'env> !UnwindSafe 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