1 //! A configurable source of time.
2 //!
3 //! This module provides an API to get the current instant in such a way that
4 //! the source of time may be configured. This allows mocking out the source of
5 //! time in tests.
6 //!
7 //! The [`now`][n] function returns the current [`Instant`]. By default, it delegates
8 //! to [`Instant::now`].
9 //!
10 //! The source of time used by [`now`][n] can be configured by implementing the
11 //! [`Now`] trait and passing an instance to [`with_default`].
12 //!
13 //! [n]: fn.now.html
14 //! [`Now`]: trait.Now.html
15 //! [`Instant`]: https://doc.rust-lang.org/std/time/struct.Instant.html
16 //! [`Instant::now`]: https://doc.rust-lang.org/std/time/struct.Instant.html#method.now
17 //! [`with_default`]: fn.with_default.html
18 
19 mod clock;
20 mod now;
21 
22 pub use self::clock::{now, set_default, with_default, Clock, DefaultGuard};
23 pub use self::now::Now;
24