Skip to main content

spawn_blocking

Function spawn_blocking 

Source
pub fn spawn_blocking<T, F>(
    spawner: &dyn AsyncSpawner,
    label: &'static str,
    work: F,
) -> Result<BlockingTaskReceiver<T>, SpawnError>
where T: Send + 'static, F: FnOnce() -> T + Send + 'static,
Expand description

Spawn a blocking task through an object-safe AsyncSpawner and recover a typed result receiver on the caller side.