Skip to main content

TimeProvider

Trait TimeProvider 

Source
pub trait TimeProvider: Send + Sync {
    // Required methods
    fn current_time(&self, thread_id: ThreadId) -> TimeFuture<'_>;
    fn sleep(&self, thread_id: ThreadId, duration: Duration) -> SleepFuture<'_>;
}
Expand description

Host integration boundary for reading and waiting on the current time.

Required Methods§

Source

fn current_time(&self, thread_id: ThreadId) -> TimeFuture<'_>

Source

fn sleep(&self, thread_id: ThreadId, duration: Duration) -> SleepFuture<'_>

Waits for the given duration on this provider’s clock.

Dropping the returned future cancels the wait.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§