Skip to main content

Clock

Trait Clock 

Source
pub trait Clock: Send + Sync {
    // Required method
    fn strftime(&self, format: &str) -> String;
}
Expand description

Supplies “now”, formatted per a strftime-style format string. Injectable for determinism.

Required Methods§

Source

fn strftime(&self, format: &str) -> String

Format the current instant per the given strftime format.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl Clock for FixedClock

Source§

impl Clock for LocalClock

Available on crate feature strftime only.
Source§

impl Clock for SystemClock