Skip to main content

with_timeout

Function with_timeout 

Source
pub async fn with_timeout<F, T, E>(
    timeout_ms: u32,
    fut: F,
) -> Result<T, WithTimeoutError<E>>
where F: Future<Output = Result<T, E>>,
Expand description

Re-export the edge-nal crate Run a fallible future with a timeout.

A future is a fallible future if it resolves to a Result<T, E>.

If the future completes before the timeout, its output is returned. Otherwise, on timeout, a timeout error is returned.

Parameters:

  • timeout_ms: The timeout duration in milliseconds
  • fut: The future to run