timeout

Function timeout 

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

Run a future with a timeout.

Returns Some(result) if the future completes within the timeout, or None if the timeout expires.