From ce0af8f7a188c9b8b8b4dcc3847674fd0afbe769 Mon Sep 17 00:00:00 2001 From: Zephyr Shannon Date: Fri, 11 Sep 2020 12:44:33 -0700 Subject: [PATCH] docs: more doc fixes (#2831) Previous docs look like they were based on the docs for `insert_at`. Changed names of variables referred to and the explanation of when the value will be returned and under what condition it will be immediately available to make sense for a Duration argument instead of an Instant. --- tokio/src/sync/mod.rs | 2 +- tokio/src/sync/rwlock.rs | 2 +- tokio/src/time/delay_queue.rs | 24 +++++++++++++----------- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/tokio/src/sync/mod.rs b/tokio/src/sync/mod.rs index 5d66512d5..d50041374 100644 --- a/tokio/src/sync/mod.rs +++ b/tokio/src/sync/mod.rs @@ -406,7 +406,7 @@ //! //! The remaining synchronization primitives focus on synchronizing state. //! These are asynchronous equivalents to versions provided by `std`. They -//! operate in a similar way as their `std` counterparts parts but will wait +//! operate in a similar way as their `std` counterparts but will wait //! asynchronously instead of blocking the thread. //! //! * [`Barrier`](Barrier) Ensures multiple tasks will wait for each other to diff --git a/tokio/src/sync/rwlock.rs b/tokio/src/sync/rwlock.rs index 1bb579319..373ab109e 100644 --- a/tokio/src/sync/rwlock.rs +++ b/tokio/src/sync/rwlock.rs @@ -11,7 +11,7 @@ const MAX_READS: usize = 32; #[cfg(loom)] const MAX_READS: usize = 10; -/// An asynchronous reader-writer lock +/// An asynchronous reader-writer lock. /// /// This type of lock allows a number of readers or at most one writer at any /// point in time. The write portion of this lock typically allows modification diff --git a/tokio/src/time/delay_queue.rs b/tokio/src/time/delay_queue.rs index b02153b9e..6f755ebac 100644 --- a/tokio/src/time/delay_queue.rs +++ b/tokio/src/time/delay_queue.rs @@ -366,23 +366,25 @@ impl DelayQueue { /// This function is identical to `insert_at`, but takes a `Duration` /// instead of an `Instant`. /// - /// `value` is stored in the queue until `when` is reached. At which point, - /// `value` will be returned from [`poll_expired`]. If `when` has already been - /// reached, then `value` is immediately made available to poll. + /// `value` is stored in the queue until `timeout` duration has + /// elapsed after `insert` was called. At that point, `value` will + /// be returned from [`poll_expired`]. If `timeout` a Duration of + /// zero, then `value` is immediately made available to poll. /// - /// The return value represents the insertion and is used at an argument to - /// [`remove`] and [`reset`]. Note that [`Key`] is token and is reused once - /// `value` is removed from the queue either by calling [`poll_expired`] after - /// `when` is reached or by calling [`remove`]. At this point, the caller - /// must take care to not use the returned [`Key`] again as it may reference - /// a different item in the queue. + /// The return value represents the insertion and is used as an + /// argument to [`remove`] and [`reset`]. Note that [`Key`] is a + /// token and is reused once `value` is removed from the queue + /// either by calling [`poll_expired`] after `timeout` has elapsed + /// or by calling [`remove`]. At this point, the caller must not + /// use the returned [`Key`] again as it may reference a different + /// item in the queue. /// /// See [type] level documentation for more details. /// /// # Panics /// - /// This function panics if `timeout` is greater than the maximum supported - /// duration. + /// This function panics if `timeout` is greater than the maximum + /// duration supported by the timer in the current `Runtime`. /// /// # Examples ///