pub trait ExecutorBlocking: Executor {
// Required method
fn spawn_blocking<F, R>(&self, f: F) -> JoinHandle<R> ⓘ
where F: FnOnce() -> R + Send + 'static,
R: Send + 'static;
}Required Methods§
Sourcefn spawn_blocking<F, R>(&self, f: F) -> JoinHandle<R> ⓘ
fn spawn_blocking<F, R>(&self, f: F) -> JoinHandle<R> ⓘ
Spawn a thread in the background with the ability to concurrently await on the results without blocking the executor.
Note that there is no real way to abort the thread, and calling JoinHandle::abort
would only abort the underlining tasked that is being polled but not the thread itself.
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.