Skip to main content

Clock

Trait Clock 

Source
pub trait Clock: Send + Sync {
    // Required method
    fn now(&self) -> DateTime<Utc>;
}
Expand description

Provides the current wall-clock time.

Required Methods§

Source

fn now(&self) -> DateTime<Utc>

The current time.

Trait Implementations§

Source§

impl Debug for dyn Clock

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T: Clock + ?Sized> Clock for Arc<T>

Source§

fn now(&self) -> DateTime<Utc>

Implementors§

Source§

impl Clock for FixedClock

Source§

impl Clock for SystemClock

Source§

impl<F> Clock for F
where F: Fn() -> DateTime<Utc> + Send + Sync,