timeout

Function timeout 

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

If the future completes before the duration has elapsed, then the completed value is returned. Otherwise, an error is returned and the future is canceled.