spawn_blocking

Function spawn_blocking 

Source
pub fn spawn_blocking<F, T, CS>(
    function: F,
) -> (impl Future<Output = T> + 'static + Send, CS::ThreadHandle)
where F: FnOnce() -> T + Send + 'static, T: 'static + Send, CS: ThreadSpawner<()> + 'static,
Expand description

Returns a future that will contain the result of function. Function will be called in another thread as to not block the main thread. Infallible version of try_spawn_blocking.