Skip to main content

TimeoutExt

Trait TimeoutExt 

Source
pub trait TimeoutExt: Future + Sized {
    // Provided method
    fn timeout(
        self,
        duration: Duration,
    ) -> impl Future<Output = Option<Self::Output>> { ... }
}
Expand description

Extension trait adding a .timeout(duration) combinator to any future.

Returns Some(output) if the future completes in time, or None if it elapses — matching smol_timeout2::TimeoutExt.

Provided Methods§

Source

fn timeout( self, duration: Duration, ) -> impl Future<Output = Option<Self::Output>>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<F: Future> TimeoutExt for F