diff options
Diffstat (limited to 'third_party/rust/tokio-timer/src/clock/now.rs')
-rw-r--r-- | third_party/rust/tokio-timer/src/clock/now.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/third_party/rust/tokio-timer/src/clock/now.rs b/third_party/rust/tokio-timer/src/clock/now.rs new file mode 100644 index 0000000000..18450c8302 --- /dev/null +++ b/third_party/rust/tokio-timer/src/clock/now.rs @@ -0,0 +1,15 @@ +use std::time::Instant; + +/// Returns [`Instant`] values representing the current instant in time. +/// +/// This allows customizing the source of time which is especially useful for +/// testing. +/// +/// Implementations must ensure that calls to `now` return monotonically +/// increasing [`Instant`] values. +/// +/// [`Instant`]: https://doc.rust-lang.org/std/time/struct.Instant.html +pub trait Now: Send + Sync + 'static { + /// Returns an instant corresponding to "now". + fn now(&self) -> Instant; +} |