Skip to main content

timeout

Function timeout 

Source
pub async fn timeout<F>(
    duration: Duration,
    future: F,
) -> Result<F::Output, TimeoutError>
where F: Future,
Expand description

Await future with a deadline.

On native: delegates to tokio::time::timeout. On wasm32: races the future against a setTimeout-based timer.

ยงErrors

Returns TimeoutError if the future does not complete within duration.