Skip to main content

spawn_blocking

Function spawn_blocking 

Source
pub fn spawn_blocking<F, R>(f: F) -> BlockingResult<R> 
where F: FnOnce() -> R + Send + 'static, R: Send + 'static,
Expand description

Spawns a blocking task on a new thread and waits for it to complete.

If the returned future is dropped, the blocking task is cancelled. Call detach to allow the task to continue running in the background.