pub trait IntoTimeout: Future + Sized {
    // Provided methods
    fn timeout(self, timeout: Duration) -> Timeout<Self>  { ... }
    fn deadline(self, deadline: Instant) -> Timeout<Self>  { ... }
}
Expand description

Futures implementing this trait can be constrained with a timeout (see Timeout).

NOTE: this trait is implemented for all type implementing std::future::Future, but it must be used only with futures from crate::fiber::async otherwise the behaviour is undefined.

Provided Methods§

source

fn timeout(self, timeout: Duration) -> Timeout<Self>

Adds timeout to a future. See Timeout.

source

fn deadline(self, deadline: Instant) -> Timeout<Self>

Adds a deadline to the future. See Timeout.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<T> IntoTimeout for T
where T: Future + Sized,