pub trait Timing: Send + Sync {
// Required methods
fn monotonic(&self) -> Instant;
fn wall(&self) -> SystemTime;
fn jitter(&self, ceiling: Duration) -> Duration;
fn sleep<'life0, 'async_trait>(
&'life0 self,
delay: Duration,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Inject both monotonic and wall time, sleep, and full jitter for deterministic tests.
Required Methods§
fn monotonic(&self) -> Instant
fn wall(&self) -> SystemTime
fn jitter(&self, ceiling: Duration) -> Duration
fn sleep<'life0, 'async_trait>(
&'life0 self,
delay: Duration,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".