Skip to main content

spawn_blocking

Function spawn_blocking 

Source
pub fn spawn_blocking<T: Send + 'static>(
    job: impl FnOnce() -> T + Send + 'static,
) -> Blocking<T> ⓘ
Expand description

Runs job on the blocking pool, like tokio::task::spawn_blocking.

Like an async fn, the job is handed to the pool when the returned future is first polled, not when it is created. The future resolves to the JoinError when the job panicked or the runtime shut down.