[][src]Trait executor_trait::Executor

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

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

Required methods

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

Spawn a future and return a handle to get its result on completion.

Dropping the handle will cancel the future. You can call detach() to let it run without waiting for its completion.

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

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

Dropping the handle will cancel the future. You can call detach() to let it run without waiting for its completion.

#[must_use]pub fn spawn_blocking<'life0, 'async_trait, F: FnOnce() -> T + Send + 'static, T: Send + 'static>(
    &'life0 self,
    f: F
) -> Pin<Box<dyn Future<Output = T> + Send + 'async_trait>> where
    F: 'async_trait,
    T: 'async_trait,
    '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...