Skip to main content

TimeProvider

Trait TimeProvider 

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

A source of the current time that tests can replace.

Required Methods§

Source

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

Returns the current time.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl<F: Fn() -> DateTime<Utc> + Send + Sync> TimeProvider for F