|
13 | 13 | //! This module provides message-based communication over channels, concretely
|
14 | 14 | //! defined among three types:
|
15 | 15 | //!
|
16 |
| -//! * `Sender` |
17 |
| -//! * `SyncSender` |
18 |
| -//! * `Receiver` |
| 16 | +//! * [`Sender`] |
| 17 | +//! * [`SyncSender`] |
| 18 | +//! * [`Receiver`] |
19 | 19 | //!
|
20 |
| -//! A `Sender` or `SyncSender` is used to send data to a `Receiver`. Both |
| 20 | +//! A [`Sender`] or [`SyncSender`] is used to send data to a [`Receiver`]. Both |
21 | 21 | //! senders are clone-able (multi-producer) such that many threads can send
|
22 | 22 | //! simultaneously to one receiver (single-consumer).
|
23 | 23 | //!
|
24 | 24 | //! These channels come in two flavors:
|
25 | 25 | //!
|
26 |
| -//! 1. An asynchronous, infinitely buffered channel. The `channel()` function |
| 26 | +//! 1. An asynchronous, infinitely buffered channel. The [`channel()`] function |
27 | 27 | //! will return a `(Sender, Receiver)` tuple where all sends will be
|
28 | 28 | //! **asynchronous** (they never block). The channel conceptually has an
|
29 | 29 | //! infinite buffer.
|
30 | 30 | //!
|
31 |
| -//! 2. A synchronous, bounded channel. The `sync_channel()` function will return |
32 |
| -//! a `(SyncSender, Receiver)` tuple where the storage for pending messages |
33 |
| -//! is a pre-allocated buffer of a fixed size. All sends will be |
| 31 | +//! 2. A synchronous, bounded channel. The [`sync_channel()`] function will |
| 32 | +//! return a `(SyncSender, Receiver)` tuple where the storage for pending |
| 33 | +//! messages is a pre-allocated buffer of a fixed size. All sends will be |
34 | 34 | //! **synchronous** by blocking until there is buffer space available. Note
|
35 |
| -//! that a bound of 0 is allowed, causing the channel to become a |
36 |
| -//! "rendezvous" channel where each sender atomically hands off a message to |
37 |
| -//! a receiver. |
| 35 | +//! that a bound of 0 is allowed, causing the channel to become a "rendezvous" |
| 36 | +//! channel where each sender atomically hands off a message to a receiver. |
| 37 | +//! |
| 38 | +//! [`Sender`]: ../../../std/sync/mpsc/struct.Sender.html |
| 39 | +//! [`SyncSender`]: ../../../std/sync/mpsc/struct.SyncSender.html |
| 40 | +//! [`Receiver`]: ../../../std/sync/mpsc/struct.Receiver.html |
| 41 | +//! [`send`]: ../../../std/sync/mpsc/struct.Sender.html#method.send |
| 42 | +//! [`channel()`]: ../../../std/sync/mpsc/fn.channel.html |
| 43 | +//! [`sync_channel()`]: ../../../std/sync/mpsc/fn.sync_channel.html |
38 | 44 | //!
|
39 | 45 | //! ## Disconnection
|
40 | 46 | //!
|
41 |
| -//! The send and receive operations on channels will all return a `Result` |
| 47 | +//! The send and receive operations on channels will all return a [`Result`] |
42 | 48 | //! indicating whether the operation succeeded or not. An unsuccessful operation
|
43 | 49 | //! is normally indicative of the other half of a channel having "hung up" by
|
44 | 50 | //! being dropped in its corresponding thread.
|
45 | 51 | //!
|
46 | 52 | //! Once half of a channel has been deallocated, most operations can no longer
|
47 |
| -//! continue to make progress, so `Err` will be returned. Many applications will |
48 |
| -//! continue to `unwrap()` the results returned from this module, instigating a |
49 |
| -//! propagation of failure among threads if one unexpectedly dies. |
| 53 | +//! continue to make progress, so [`Err`] will be returned. Many applications |
| 54 | +//! will continue to [`unwrap()`] the results returned from this module, |
| 55 | +//! instigating a propagation of failure among threads if one unexpectedly dies. |
| 56 | +//! |
| 57 | +//! [`Result`]: ../../../std/result/enum.Result.html |
| 58 | +//! [`Err`]: ../../../std/result/enum.Result.html#variant.Err |
| 59 | +//! [`unwrap()`]: ../../../std/result/enum.Result.html#method.unwrap |
50 | 60 | //!
|
51 | 61 | //! # Examples
|
52 | 62 | //!
|
|
0 commit comments