Skip to main content

Timer

Trait Timer 

Source
pub trait Timer:
    Send
    + Sync
    + 'static {
    // Required method
    fn delay<'a>(
        &'a self,
        duration: Duration,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'a>>;
}
Expand description

Produces timer delays. with_timeout (below) is built on top of this single dyn-safe method rather than a generic timeout<F> method, so Timer itself stays object-safe.

Required Methods§

Source

fn delay<'a>( &'a self, duration: Duration, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'a>>

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§