Skip to main content

Clock

Trait Clock 

Source
pub trait Clock: Send + Sync {
    // Required method
    fn now(&self) -> OffsetDateTime;

    // Provided method
    fn timeout_any<'life0, 'async_trait>(
        &'life0 self,
        fut: BoxFuture<'static, Box<dyn Any + Send>>,
        after: Duration,
    ) -> Pin<Box<dyn Future<Output = Option<Box<dyn Any + Send>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
}

Required Methods§

Provided Methods§

Source

fn timeout_any<'life0, 'async_trait>( &'life0 self, fut: BoxFuture<'static, Box<dyn Any + Send>>, after: Duration, ) -> Pin<Box<dyn Future<Output = Option<Box<dyn Any + Send>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Runs fut to completion, abandoning it after after elapses. Returns None on timeout. Default: runs to completion (no timer; test-only — runtimes override).

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§