Trait async_executors::iface::TimerExt
source · [−]pub trait TimerExt: Timer {
fn timeout<F: Future>(&self, duration: Duration, future: F) -> Timeout<F>ⓘNotable traits for Timeout<T>impl<T> Future for Timeout<T> where
T: Future, type Output = Result<T::Output, TimeoutError>; { ... }
}Expand description
An extension trait on Timer for timeouts and clock delays.
Provided Methods
Wrap a Future with a timeout.
The output of the new future will be the returned value of
future if it completes within duration. Otherwise, it
will be Err(TimeoutError).
Limitations
This uses Timer::sleep for its timer, and is
subject to the same limitations.