1 use std::time::Instant;
2 
3 /// Returns [`Instant`] values representing the current instant in time.
4 ///
5 /// This allows customizing the source of time which is especially useful for
6 /// testing.
7 ///
8 /// Implementations must ensure that calls to `now` return monotonically
9 /// increasing [`Instant`] values.
10 ///
11 /// [`Instant`]: https://doc.rust-lang.org/std/time/struct.Instant.html
12 pub trait Now: Send + Sync + 'static {
13     /// Returns an instant corresponding to "now".
now(&self) -> Instant14     fn now(&self) -> Instant;
15 }
16