Skip to main content

ClockSource

Trait ClockSource 

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

Source of the current wall-clock time used internally by the framework.

Production apps see SystemClock (the silent default). Tests swap it out via crate::test::TestApp::with_clock.

Implement this trait to supply a custom clock (e.g. from an NTP client or a property-testing generator).

Required Methods§

Source

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

Returns the current UTC instant.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§