Struct yastl::Scope

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

A scope represents a bunch of jobs that must be finished if this scope is dropped.

Implementations§

source§

impl<'scope> Scope<'scope>

source

pub fn forever(pool: Pool) -> Scope<'static>

Create a Scope which lasts forever.

source

pub fn execute<F>(&self, job: F)
where F: FnOnce() + Send + 'scope,

Add a job to this scope.

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

source

pub fn recurse<F>(&self, job: F)
where F: FnOnce(&Self) + Send + 'scope,

Add a job to this scope, which will also get access to this scope and thus can spawn more jobs that belong to this scope.

source

pub fn join(&self)

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.

source

pub fn zoom<'smaller, F, R>(&self, job: F) -> R
where F: FnOnce(&Scope<'smaller>) -> R, 'scope: 'smaller,

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.

Trait Implementations§

source§

impl Send for Scope<'_>

source§

impl Sync for Scope<'_>

Auto Trait Implementations§

§

impl<'scope> Freeze for Scope<'scope>

§

impl<'scope> RefUnwindSafe for Scope<'scope>

§

impl<'scope> Unpin for Scope<'scope>

§

impl<'scope> UnwindSafe for Scope<'scope>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

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

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.