Skip to main content

spawn_timeout

Function spawn_timeout 

Source
pub fn spawn_timeout<F>(
    duration: Duration,
    future: F,
) -> JoinHandle<Result<F::Output, TimeoutError>> 
where F: Future + Send + 'static, F::Output: Send + 'static,
Expand description

Spawns a new asynchronous task that must complete within duration.

If it does not, the future is dropped and the task completes with TimeoutError.