Skip to main content

Clock

Trait Clock 

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

A source of the current time, so domain/application code doesn’t call chrono::Utc::now directly and become untestable.

Required Methods§

Source

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

The current time.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§