pub trait Clock:
Send
+ Sync
+ Debug {
// Required methods
fn elapsed(&self) -> Duration;
fn sleep(
&self,
duration: Duration,
) -> Pin<Box<dyn Future<Output = ()> + Send + '_>>;
fn unix_now(&self) -> Duration;
// Provided method
fn today_utc(&self) -> Result<CalendarDate, Error> { ... }
}Expand description
The clock a refresh boundary is measured on. It’s the crate’s one Clock, and the
production one is tokio’s (TokioClock, in microvms-edges): a token timed on
std::time::Instant would never re-mint inside a simulation.
Time, injectable so a wait or a refresh boundary is a test rather than a wait.
Required Methods§
Provided Methods§
Sourcefn today_utc(&self) -> Result<CalendarDate, Error>
fn today_utc(&self) -> Result<CalendarDate, Error>
Today, UTC, for the cost engine’s dates.
Fails only for a wall reading past 9999-12-31, the last date the domain represents.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".