SpawnBlocking

Trait SpawnBlocking 

Source
pub trait SpawnBlocking {
    // Required method
    fn spawn_blocking<F, T>(f: F) -> JoinHandle<T> 
       where F: FnOnce() -> T + Send + 'static,
             T: Send + 'static;
}
Expand description

An abstraction over executing a sync task in a new blocking thread and optionally awaiting it’s completion in an async fashion.

Required Methods§

Source

fn spawn_blocking<F, T>(f: F) -> JoinHandle<T>
where F: FnOnce() -> T + Send + 'static, T: Send + 'static,

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§

Source§

impl SpawnBlocking for AsyncStdExecutor

Available on crate feature async-std-rt only.
Source§

impl SpawnBlocking for TokioExecutor

Available on crate feature tokio-rt only.