pub struct Scope<'scope> { /* private fields */ }
Expand description

An execution scope, represents a set of jobs running on a Pool.

Understanding Scope lifetimes

Besides Scope<'static>, all Scope objects are accessed behind a reference of the form &'scheduler Scope<'scope>.

'scheduler is the lifetime associated with the body of the “scheduler” function (functions passed to zoom/scoped).

'scope is the lifetime which data captured in execute or recurse closures must outlive - in other words, 'scope is the maximum lifetime of all jobs scheduler on a Scope.

Note that since 'scope: 'scheduler ('scope outlives 'scheduler) &'scheduler Scope<'scope> can’t be captured in an execute closure; this is the reason for the existence of the recurse API, which will inject the same scope with a new 'scheduler lifetime (this time set to the body of the function passed to recurse).

Implementations

Create a Scope which lasts forever.

Add a job to this scope.

Subsequent calls to join will wait for this job to complete.

Add a job to this scope which itself will get access to the scope.

Like with execute, subsequent calls to join will wait for this job (and all jobs scheduled on the scope it receives) to complete.

Create a new subscope, bound to a lifetime smaller than our existing Scope.

The subscope has a different job set, and is joined before zoom returns.

Awaits all jobs submitted on this Scope to be completed.

Only guaranteed to join jobs which where executed logically prior to join. Jobs executed concurrently with join may or may not be completed before join returns.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.