Skip to main content

BlockingExecutor

Trait BlockingExecutor 

Source
pub trait BlockingExecutor {
    // Required method
    fn execute_blocking<'async_trait, T, F>(
        f: F,
    ) -> Pin<Box<dyn Future<Output = Result<T>> + Send + 'async_trait>>
       where T: Send + 'static + 'async_trait,
             F: FnOnce() -> T + Send + 'static + 'async_trait;
}

Required Methods§

Source

fn execute_blocking<'async_trait, T, F>( f: F, ) -> Pin<Box<dyn Future<Output = Result<T>> + Send + 'async_trait>>
where T: Send + 'static + 'async_trait, F: FnOnce() -> T + Send + 'static + 'async_trait,

Execute the provided function on a thread where blocking is acceptable (in some kind of thread pool).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§