pub async fn timeout<F, T>(
future: F,
duration: Duration,
) -> Result<T, ElapsedError>where
F: Future<Output = T>,
Expand description
Wait for future
to be completed. future
needs to return
a Result
.
If the given timeout has elapsed the method will stop waiting and return an error.