Skip to content

Commit 8565a98

Browse files
authored
docs: fix links in tokio::sync (#2491)
Fixes: #2489
1 parent bff21ab commit 8565a98

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

tokio/src/sync/mod.rs

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
//! single producer to a single consumer. This channel is usually used to send
3333
//! the result of a computation to a waiter.
3434
//!
35-
//! **Example:** using a `oneshot` channel to receive the result of a
35+
//! **Example:** using a [`oneshot` channel][oneshot] to receive the result of a
3636
//! computation.
3737
//!
3838
//! ```
@@ -232,7 +232,7 @@
232232
//!
233233
//! ## `broadcast` channel
234234
//!
235-
//! The [`broadcast` channel][broadcast] supports sending **many** values from
235+
//! The [`broadcast` channel] supports sending **many** values from
236236
//! **many** producers to **many** consumers. Each consumer will receive
237237
//! **each** value. This channel can be used to implement "fan out" style
238238
//! patterns common with pub / sub or "chat" systems.
@@ -265,22 +265,24 @@
265265
//! }
266266
//! ```
267267
//!
268+
//! [`broadcast` channel]: crate::sync::broadcast
269+
//!
268270
//! ## `watch` channel
269271
//!
270-
//! The [`watch` channel][watch] supports sending **many** values from a
271-
//! **single** producer to **many** consumers. However, only the **most recent**
272-
//! value is stored in the channel. Consumers are notified when a new value is
273-
//! sent, but there is no guarantee that consumers will see **all** values.
272+
//! The [`watch` channel] supports sending **many** values from a **single**
273+
//! producer to **many** consumers. However, only the **most recent** value is
274+
//! stored in the channel. Consumers are notified when a new value is sent, but
275+
//! there is no guarantee that consumers will see **all** values.
274276
//!
275277
//! The [`watch` channel] is similar to a [`broadcast` channel] with capacity 1.
276278
//!
277279
//! Use cases for the [`watch` channel] include broadcasting configuration
278280
//! changes or signalling program state changes, such as transitioning to
279281
//! shutdown.
280282
//!
281-
//! **Example:** use a `watch` channel to notify tasks of configuration changes.
282-
//! In this example, a configuration file is checked periodically. When the file
283-
//! changes, the configuration changes are signalled to consumers.
283+
//! **Example:** use a [`watch` channel] to notify tasks of configuration
284+
//! changes. In this example, a configuration file is checked periodically. When
285+
//! the file changes, the configuration changes are signalled to consumers.
284286
//!
285287
//! ```
286288
//! use tokio::sync::watch;
@@ -393,6 +395,9 @@
393395
//! }
394396
//! ```
395397
//!
398+
//! [`watch` channel]: crate::sync::watch
399+
//! [`broadcast` channel]: crate::sync::broadcast
400+
//!
396401
//! # State synchronization
397402
//!
398403
//! The remaining synchronization primitives focus on synchronizing state.

0 commit comments

Comments
 (0)