[][src]Struct smartpool::scoped::Scope

pub struct Scope<'env> { /* fields omitted */ }

A handle to a batch of scoped operations, which allow non-static futures to be wrapped into static futures, which prevent this the batch stack frame from exiting until they complete.

Methods

impl<'env> Scope<'env>[src]

#[must_use]
pub fn wrap<'scope, F: Future<Item = (), Error = ()> + Send + 'env>(
    &'scope self,
    future_factory: impl FnOnce() -> F
) -> Box<dyn Future<Item = (), Error = ()> + Send + 'static>
[src]

Wrap a non-static future into a static-future (which will block this scoped batch stack frame), allowing that future to be submitted to a threadpool.

#[must_use]
pub fn work<'scope>(
    &'scope self,
    work: impl FnOnce() + Send + 'env
) -> Box<dyn Future<Item = (), Error = ()> + Send + 'static>
[src]

A convenience utility for wrapping some pure, non-blocking work.

Auto Trait Implementations

impl<'env> Send for Scope<'env>

impl<'env> Sync for Scope<'env>

Blanket Implementations

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.