Function timeout

Source
pub async fn timeout<T, F>(duration: Duration, f: F) -> Option<T>
where F: Future<Output = T> + Send,