From 11952635840298d307dc10b26e6bdc78188c84ef Mon Sep 17 00:00:00 2001 From: Geoff Shannon Date: Sun, 27 Oct 2019 09:37:07 -0700 Subject: [PATCH] Fix docs links: Redux (#1698) --- tokio-sync/src/watch.rs | 33 +++++++++++++++++---------------- tokio/src/fs/read_dir.rs | 6 +++--- tokio/src/process/mod.rs | 4 ++-- 3 files changed, 22 insertions(+), 21 deletions(-) diff --git a/tokio-sync/src/watch.rs b/tokio-sync/src/watch.rs index 7b1e62409..e6b33136f 100644 --- a/tokio-sync/src/watch.rs +++ b/tokio-sync/src/watch.rs @@ -6,14 +6,13 @@ //! //! # Usage //! -//! [`channel`] returns a [`Sender`] / [`Receiver`] pair. These are the producer -//! and sender halves of the channel. The channel is created with an initial -//! value. `Receiver::poll` will always be ready upon creation and will yield -//! either this initial value or the latest value that has been sent by -//! `Sender`. +//! [`channel`] returns a [`Sender`] / [`Receiver`] pair. These are +//! the producer and sender halves of the channel. The channel is +//! created with an initial value. [`Receiver::get_ref`] will always +//! be ready upon creation and will yield either this initial value or +//! the latest value that has been sent by `Sender`. //! -//! Calls to [`Receiver::poll`] and [`Receiver::poll_ref`] will always yield -//! the latest value. +//! Calls to [`Receiver::get_ref`] will always yield the latest value. //! //! # Examples //! @@ -36,7 +35,7 @@ //! //! # Closing //! -//! [`Sender::poll_close`] allows the producer to detect when all [`Sender`] +//! [`Sender::closed`] allows the producer to detect when all [`Receiver`] //! handles have been dropped. This indicates that there is no further interest //! in the values being produced and work can be stopped. //! @@ -49,9 +48,8 @@ //! [`Sender`]: struct.Sender.html //! [`Receiver`]: struct.Receiver.html //! [`channel`]: fn.channel.html -//! [`Sender::poll_close`]: struct.Sender.html#method.poll_close -//! [`Receiver::poll`]: struct.Receiver.html#method.poll -//! [`Receiver::poll_ref`]: struct.Receiver.html#method.poll_ref +//! [`Sender::closed`]: struct.Sender.html#method.closed +//! [`Receiver::get_ref`]: struct.Receiver.html#method.get_ref use crate::task::AtomicWaker; @@ -71,7 +69,7 @@ use futures_util::pin_mut; #[cfg(feature = "async-traits")] use std::pin::Pin; -/// Receives values from the associated `Sender`. +/// Receives values from the associated [`Sender`](struct.Sender.html). /// /// Instances are created by the [`channel`](fn.channel.html) function. #[derive(Debug)] @@ -89,7 +87,7 @@ pub struct Receiver { ver: usize, } -/// Sends values to the associated `Receiver`. +/// Sends values to the associated [`Receiver`](struct.Receiver.html). /// /// Instances are created by the [`channel`](fn.channel.html) function. #[derive(Debug)] @@ -162,8 +160,8 @@ const CLOSED: usize = 1; /// Create a new watch channel, returning the "send" and "receive" handles. /// -/// All values sent by `Sender` will become visible to the `Receiver` handles. -/// Only the last value sent is made available to the `Receiver` half. All +/// All values sent by [`Sender`] will become visible to the [`Receiver`] handles. +/// Only the last value sent is made available to the [`Receiver`] half. All /// intermediate values are dropped. /// /// # Examples @@ -184,6 +182,9 @@ const CLOSED: usize = 1; /// # Ok(()) /// # } /// ``` +/// +/// [`Sender`]: struct.Sender.html +/// [`Receiver`]: struct.Receiver.html pub fn channel(init: T) -> (Sender, Receiver) { const INIT_ID: u64 = 0; @@ -290,7 +291,7 @@ impl Receiver { /// Attempts to clone the latest value sent via the channel. /// /// This is equivalent to calling `clone()` on the value returned by - /// `recv()`. + /// `recv_ref()`. #[allow(clippy::map_clone)] // false positive: https://github.com/rust-lang/rust-clippy/issues/3274 pub async fn recv(&mut self) -> Option { self.recv_ref().await.map(|v_ref| v_ref.clone()) diff --git a/tokio/src/fs/read_dir.rs b/tokio/src/fs/read_dir.rs index 52208430a..0fd5bf0b5 100644 --- a/tokio/src/fs/read_dir.rs +++ b/tokio/src/fs/read_dir.rs @@ -36,8 +36,8 @@ pub async fn read_dir(path: impl AsRef) -> io::Result { /// This [`Stream`] will return an [`Err`] if there's some sort of intermittent /// IO error during iteration. /// -/// [`read_dir`]: fn.read_dir.html -/// [`DirEntry`]: struct.DirEntry.html +/// [`read_dir`]: read_dir +/// [`DirEntry`]: DirEntry /// [`Stream`]: Stream /// [`Err`]: std::result::Result::Err #[derive(Debug)] @@ -81,7 +81,7 @@ impl Stream for ReadDir { /// /// [`ReadDir`]: struct.ReadDir.html /// -/// This is a specialized version of [`std::fs::DirEntry`](std::fs::DirEntry) for usage from the +/// This is a specialized version of [`std::fs::DirEntry`] for usage from the /// Tokio runtime. /// /// An instance of `DirEntry` represents an entry inside of a directory on the diff --git a/tokio/src/process/mod.rs b/tokio/src/process/mod.rs index 14ffd20ed..45bd23fd6 100644 --- a/tokio/src/process/mod.rs +++ b/tokio/src/process/mod.rs @@ -1,6 +1,6 @@ //! An implementation of asynchronous process management for Tokio. //! -//! This module provides a [`Command`](crate::process::Command) struct that imitates the interface of the +//! This module provides a [`Command`] struct that imitates the interface of the //! [`std::process::Command`] type in the standard library, but provides asynchronous versions of //! functions that create processes. These functions (`spawn`, `status`, `output` and their //! variants) return "future aware" types that interoperate with Tokio. The asynchronous process @@ -102,7 +102,7 @@ //! While similar to the standard library, this crate's `Child` type differs //! importantly in the behavior of `drop`. In the standard library, a child //! process will continue running after the instance of [`std::process::Child`] -//! is dropped. In this crate, however, because [`tokio::process::Child`](crate::process::Child) is a +//! is dropped. In this crate, however, because [`tokio::process::Child`] is a //! future of the child's `ExitStatus`, a child process is terminated if //! `tokio::process::Child` is dropped. The behavior of the standard library can //! be regained with the [`Child::forget`](crate::process::Child::forget) method.