pub trait Clock:
Send
+ Sync
+ BoxedClockClone {
// Required method
fn now(&self) -> SystemTime;
// Provided method
fn has_passed(&self, time: &SystemTime) -> bool { ... }
}Expand description
Clock represents a trait to get the current std::time::SystemTime.
The default implementation of Clock is SystemClock.
Clients can provide their implementation of Clock using crate::cache::config::Config and
since Clock is considered to be a lightweight object, Clock is of type BoxedClockClone.
Required Methods§
fn now(&self) -> SystemTime
Provided Methods§
fn has_passed(&self, time: &SystemTime) -> bool
Trait Implementations§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".