try_spawn_blocking

Function try_spawn_blocking 

Source
pub fn try_spawn_blocking<F, T, CS>(
    function: F,
) -> Result<(impl Future<Output = T> + 'static + Send, CS::ThreadHandle), CS::SpawnError>
where F: FnOnce() -> T + Send + 'static, T: 'static + Send, CS: TryThreadSpawner<()>,
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. Fallible version of spawn_blocking.