Trait BlockingExecutor

Source
pub trait BlockingExecutor {
    // Required method
    fn spawn_blocking<'life0, 'async_trait>(
        &'life0 self,
        f: Box<dyn FnOnce() + Send + 'static>,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

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

Required Methods§

Source

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

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

Implementors§