Skip to main content

Clock

Trait Clock 

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

Clock abstraction used by the cache and other resilience primitives.

The default implementation reads from tokio::time::Instant::now, which honors [tokio::time::pause]/advance in tests. Callers with a custom time source may provide their own implementation.

Required Methods§

Source

fn now(&self) -> Instant

Return the current monotonic instant.

Implementors§