Trait IntoTimeout

Source
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.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

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