pub async fn with_timeout<F: Future>( timeout: Duration, fut: F ) -> Result<F::Output, TimeoutError>
Runs a given future with a timeout.
If the future completes before the timeout, its output is returned. Otherwise, on timeout,
work on the future is stopped (
poll is no longer called), the future is dropped and
Err(TimeoutError) is returned.