[][src]Trait executor_trait::Executor

pub trait Executor {
    pub fn block_on(&self, f: Pin<Box<dyn Future<Output = ()>>>);
pub fn spawn(
        &self,
        f: Pin<Box<dyn Future<Output = ()> + Send>>
    ) -> Box<dyn Task>;
pub fn spawn_local(
        &self,
        f: Pin<Box<dyn Future<Output = ()>>>
    ) -> Box<dyn Task>;
#[must_use] pub fn spawn_blocking<'life0, 'async_trait>(
        &'life0 self,
        f: Box<dyn FnOnce() + Send + 'static>
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
; }

A common interface for spawning futures and blocking tasks on top of an executor

Required methods

pub fn block_on(&self, f: Pin<Box<dyn Future<Output = ()>>>)[src]

Block on a future until completion

pub fn spawn(
    &self,
    f: Pin<Box<dyn Future<Output = ()> + Send>>
) -> Box<dyn Task>
[src]

Spawn a future and return a handle to track its completion.

pub fn spawn_local(&self, f: Pin<Box<dyn Future<Output = ()>>>) -> Box<dyn Task>[src]

Spawn a non-Send future on the current thread and return a handle to track its completion.

#[must_use]pub fn spawn_blocking<'life0, 'async_trait>(
    &'life0 self,
    f: Box<dyn FnOnce() + Send + 'static>
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>> where
    'life0: 'async_trait,
    Self: 'async_trait, 
[src]

Convert a blocking task into a future, spawning it on a decicated thread pool

Loading content...

Implementors

impl<E: Deref + Sync> Executor for E where
    E::Target: Executor + Sync
[src]

Loading content...