pub trait Clock {
// Required methods
fn now() -> Self;
fn set_scaling_factor(&mut self, scaling: usize);
fn duration_since(&self, earlier: Self) -> Duration;
}Expand description
A trait for time sources. This allows methods to be generic over different ways of measuring time.
Required Methods§
Sourcefn set_scaling_factor(&mut self, scaling: usize)
fn set_scaling_factor(&mut self, scaling: usize)
Set a scaling factor, which can be used to convert a difference of timestamps to seconds.
Sourcefn duration_since(&self, earlier: Self) -> Duration
fn duration_since(&self, earlier: Self) -> Duration
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.