diff --git a/tokio-timer/src/clock/clock.rs b/tokio-timer/src/clock/clock.rs index 2236bc63f..00179d3da 100644 --- a/tokio-timer/src/clock/clock.rs +++ b/tokio-timer/src/clock/clock.rs @@ -10,8 +10,11 @@ use std::time::Instant; /// A handle to a source of time. /// -/// `Clock` instances return `Instant` values corresponding to "now". The source -/// of these values is configurable. The default source is `Instant::now()`. +/// `Clock` instances return [`Instant`] values corresponding to "now". The source +/// of these values is configurable. The default source is [`Instant::now`]. +/// +/// [`Instant`]: https://doc.rust-lang.org/std/time/struct.Instant.html +/// [`Instant::now`]: https://doc.rust-lang.org/std/time/struct.Instant.html#method.now #[derive(Default, Clone)] pub struct Clock { now: Option>, @@ -69,8 +72,10 @@ impl Clock { } } - /// Return a new `Clock` instance that uses `Instant::now()` as the source + /// Return a new `Clock` instance that uses [`Instant::now`] as the source /// of time. + /// + /// [`Instant::now`]: https://doc.rust-lang.org/std/time/struct.Instant.html#method.now pub fn system() -> Clock { Clock { now: None, diff --git a/tokio-timer/src/clock/mod.rs b/tokio-timer/src/clock/mod.rs index 527a6818c..02b650bb3 100644 --- a/tokio-timer/src/clock/mod.rs +++ b/tokio-timer/src/clock/mod.rs @@ -4,15 +4,16 @@ //! the source of time may be configured. This allows mocking out the source of //! time in tests. //! -//! The [`now`][n] function returns the current `Instant`. By default, it delegates -//! to [`Instant::now`][std]. +//! The [`now`][n] function returns the current [`Instant`]. By default, it delegates +//! to [`Instant::now`]. //! //! The source of time used by [`now`][n] can be configured by implementing the //! [`Now`] trait and passing an instance to [`with_default`]. //! //! [n]: fn.now.html //! [`Now`]: trait.Now.html -//! [std]: https://doc.rust-lang.org/std/time/struct.Instant.html +//! [`Instant`]: https://doc.rust-lang.org/std/time/struct.Instant.html +//! [`Instant::now`]: https://doc.rust-lang.org/std/time/struct.Instant.html#method.now //! [`with_default`]: fn.with_default.html mod clock; diff --git a/tokio-timer/src/clock/now.rs b/tokio-timer/src/clock/now.rs index 65472543c..871fecfa1 100644 --- a/tokio-timer/src/clock/now.rs +++ b/tokio-timer/src/clock/now.rs @@ -1,12 +1,14 @@ use std::time::Instant; -/// Returns `Instant` values representing the current instant in time. +/// 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. +/// 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; diff --git a/tokio-timer/src/lib.rs b/tokio-timer/src/lib.rs index e6d804922..9a633116f 100644 --- a/tokio-timer/src/lib.rs +++ b/tokio-timer/src/lib.rs @@ -23,6 +23,7 @@ //! [`Timer`] instance must be running on some thread. //! //! [`Delay`]: struct.Delay.html +//! [`DelayQueue`]: struct.DelayQueue.html //! [`Throttle`]: throttle/struct.Throttle.html //! [`Timeout`]: struct.Timeout.html //! [`Interval`]: struct.Interval.html diff --git a/tokio-timer/src/timer/mod.rs b/tokio-timer/src/timer/mod.rs index 4b70d5c02..1a8ae8125 100644 --- a/tokio-timer/src/timer/mod.rs +++ b/tokio-timer/src/timer/mod.rs @@ -62,18 +62,18 @@ use std::sync::atomic::AtomicUsize; use std::sync::atomic::Ordering::SeqCst; use std::usize; -/// Timer implementation that drives [`Delay`], [`Interval`], and [`Deadline`]. +/// Timer implementation that drives [`Delay`], [`Interval`], and [`Timeout`]. /// /// A `Timer` instance tracks the state necessary for managing time and /// notifying the [`Delay`] instances once their deadlines are reached. /// /// It is expected that a single `Timer` instance manages many individual -/// `Delay` instances. The `Timer` implementation is thread-safe and, as such, +/// [`Delay`] instances. The `Timer` implementation is thread-safe and, as such, /// is able to handle callers from across threads. /// -/// Callers do not use `Timer` directly to create `Delay` instances. Instead, -/// [`Handle`] is used. A handle for the timer instance is obtained by calling -/// [`handle`]. [`Handle`] is the type that implements `Clone` and is `Send + +/// Callers do not use `Timer` directly to create [`Delay`] instances. Instead, +/// [`Handle`][Handle.struct] is used. A handle for the timer instance is obtained by calling +/// [`handle`]. [`Handle`][Handle.struct] is the type that implements `Clone` and is `Send + /// Sync`. /// /// After creating the `Timer` instance, the caller must repeatedly call @@ -83,9 +83,9 @@ use std::usize; /// The `Timer` has a resolution of one millisecond. Any unit of time that falls /// between milliseconds are rounded up to the next millisecond. /// -/// When the `Timer` instance is dropped, any outstanding `Delay` instance that +/// When the `Timer` instance is dropped, any outstanding [`Delay`] instance that /// has not elapsed will be notified with an error. At this point, calling -/// `poll` on the `Delay` instance will result in `Err` being returned. +/// `poll` on the [`Delay`] instance will result in `Err` being returned. /// /// # Implementation /// @@ -114,17 +114,17 @@ use std::usize; /// When the timer processes entries at level zero, it will notify all the /// [`Delay`] instances as their deadlines have been reached. For all higher /// levels, all entries will be redistributed across the wheel at the next level -/// down. Eventually, as time progresses, entries will `Delay` instances will +/// down. Eventually, as time progresses, entries will [`Delay`] instances will /// either be canceled (dropped) or their associated entries will reach level /// zero and be notified. /// /// [`Delay`]: ../struct.Delay.html /// [`Interval`]: ../struct.Interval.html -/// [`Deadline`]: ../struct.Deadline.html +/// [`Timeout`]: ../struct.Timeout.html /// [paper]: http://www.cs.columbia.edu/~nahum/w6998/papers/ton97-timing-wheels.pdf /// [`handle`]: #method.handle /// [`turn`]: #method.turn -/// [`Handle`]: struct.Handle.html +/// [Handle.struct]: struct.Handle.html #[derive(Debug)] pub struct Timer { /// Shared state