timeout

Function timeout 

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

Timeout wrapper for async operations.

Returns Ok(result) if the future completes within the timeout, or Err(()) if it times out.