timeout

Function timeout 

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

Execute the future up to a timeout

  • dur: The duration of time to allow the future to execute for
  • future: The future to execute

Returns [Ok(_)] if the future succeeded before the timeout, [Err(super::Timeout)] otherwise