mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-22 00:00:11 +02:00
docs: fixed links in tokio-timer (#844)
* docs: fixed links in tokio-timer/src/timer/mod.rs * docs: fixed links in tokio-timer::clock
This commit is contained in:
committed by
Sean McArthur
parent
733d432b80
commit
eec370cae8
@@ -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<Arc<Now>>,
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user