Skip to main content

spawn_blocking

Function spawn_blocking 

Source
pub async fn spawn_blocking<F, R>(
    runtime: Runtime,
    f: F,
) -> Result<R, SpawnBlockingError>
where F: FnOnce() -> R + Send + 'static, R: Send + 'static,
Expand description

Runs the given closure on a thread where blocking is acceptable.

ยงErrors

See SpawnBlockingError for details.