pub trait AsyncTimeout<F>: Future<Output = Result<<F as Future>::Output, Elapsed>> + Send
where F: Future + Send,
{ // 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§

source§

impl<F> AsyncTimeout<F> for AsyncIoTimeout<F>
where F: Future + Send,

source§

impl<F> AsyncTimeout<F> for TokioTimeout<F>
where F: Future + Send,