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§
Sourcefn with_timeout(self, duration: Duration) -> Timeout<Self>
fn with_timeout(self, duration: Duration) -> Timeout<Self>
Wrap this future with a timeout.
Provided Methods§
Sourcefn with_timeout_secs(self, secs: u64) -> Timeout<Self>
fn with_timeout_secs(self, secs: u64) -> Timeout<Self>
Wrap this future with a timeout in seconds.
Sourcefn with_timeout_ms(self, ms: u64) -> Timeout<Self>
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.