pub trait AsyncTimeout<F: Future>: Future<Output = Result<F::Output, Elapsed>> {
    // Required methods
    fn timeout(timeout: Duration, fut: F) -> Self
       where Self: Sized;
    fn timeout_at(deadline: Instant, fut: F) -> Self
       where Self: Sized;
}
Expand description

The timeout abstraction for async runtime.

Required Methods§

source

fn timeout(timeout: Duration, fut: F) -> Self
where Self: Sized,

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

The behavior of this function may different in different runtime implementations.

source

fn timeout_at(deadline: Instant, fut: F) -> Self
where Self: Sized,

Requires a Future to complete before the specified instant in time.

The behavior of this function may different in different runtime implementations.

Implementors§