Clock

Trait Clock 

Source
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§

Source

fn now(&self) -> SystemTime

Provided Methods§

Source

fn has_passed(&self, time: &SystemTime) -> bool

Trait Implementations§

Source§

impl Clone for Box<dyn Clock>

Source§

fn clone(&self) -> Box<dyn Clock>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Implementors§