Function timeout

Source
pub fn timeout<F, D>(
    duration: Duration,
    future: F,
    make_delay: &D,
) -> Timeout<F::IntoFuture, D::Delay> 
where F: IntoFuture, D: MakeDelay + ?Sized,
Expand description

Requires a Future to complete before the specified duration has elapsed.