pub trait Clock: Send + Sync {
// Required method
fn now(&self) -> Timestamp;
// Provided methods
fn advance_by(&self, _duration: Duration) { ... }
fn set(&self, _timestamp: Timestamp) { ... }
}Expand description
Required Methods§
Provided Methods§
Sourcefn advance_by(&self, _duration: Duration)
fn advance_by(&self, _duration: Duration)
Advances the clock by a duration.
The default implementation does nothing, for clocks whose time is
externally controlled (such as the host wall clock). Virtual clocks
override this to implement sleep and other time-advancing behavior.
Sourcefn set(&self, _timestamp: Timestamp)
fn set(&self, _timestamp: Timestamp)
Sets the clock to an absolute point in virtual time.
The default implementation does nothing, for the same reason as
Clock::advance_by.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".