TimeoutExt

Trait TimeoutExt 

Source
pub trait TimeoutExt: Sized {
    // Required method
    fn with_timeout(self, duration: Duration) -> Timeout<Self>;

    // Provided methods
    fn with_timeout_secs(self, secs: u64) -> Timeout<Self> { ... }
    fn with_timeout_ms(self, ms: u64) -> Timeout<Self> { ... }
}
Expand description

Extension trait for adding timeouts to futures.

Required Methods§

Source

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

Wrap this future with a timeout.

Provided Methods§

Source

fn with_timeout_secs(self, secs: u64) -> Timeout<Self>

Wrap this future with a timeout in seconds.

Source

fn with_timeout_ms(self, ms: u64) -> Timeout<Self>

Wrap this future with a timeout in milliseconds.

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<F: Future> TimeoutExt for F