Trait agnostic_lite::AsyncTimeout
source · 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§
sourcefn timeout(timeout: Duration, fut: F) -> Selfwhere
Self: Sized,
fn timeout(timeout: Duration, fut: F) -> Selfwhere
Self: Sized,
Requires a Future to complete before the specified duration has elapsed.
The behavior of this function may different in different runtime implementations.
sourcefn timeout_at(deadline: Instant, fut: F) -> Selfwhere
Self: Sized,
fn timeout_at(deadline: Instant, fut: F) -> Selfwhere
Self: Sized,
Requires a Future to complete before the specified instant in time.
The behavior of this function may different in different runtime implementations.