Skip to main content

LockClock

Trait LockClock 

Source
pub trait LockClock: Send + Sync {
    // Required methods
    fn now(&self) -> Instant;
    fn sleep(&self, duration: Duration);
}
Expand description

Injectable clock and sleep for deterministic lock backoff tests.

Required Methods§

Source

fn now(&self) -> Instant

Current instant (used for backoff deadlines).

Source

fn sleep(&self, duration: Duration)

Pause until the next acquisition attempt.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§