|
18 | 18 | //! infinite buffer.
|
19 | 19 | //!
|
20 | 20 | //! 2. A synchronous, bounded channel. The [`sync_channel`] function will
|
21 |
| -//! return a `(SyncSender, Receiver)` tuple where the storage for pending |
| 21 | +//! return a `(Sender, Receiver)` tuple where the storage for pending |
22 | 22 | //! messages is a pre-allocated buffer of a fixed size. All sends will be
|
23 | 23 | //! **synchronous** by blocking until there is buffer space available. Note
|
24 | 24 | //! that a bound of 0 is allowed, causing the channel to become a "rendezvous"
|
@@ -360,9 +360,17 @@ impl<T> Sender<T> {
|
360 | 360 | /// that a return value of [`Err`] means that the data will never be
|
361 | 361 | /// received, but a return value of [`Ok`] does *not* mean that the data
|
362 | 362 | /// will be received. It is possible for the corresponding receiver to
|
363 |
| - /// hang up immediately after this function returns [`Ok`]. |
| 363 | + /// hang up immediately after this function returns [`Ok`]. However, if |
| 364 | + /// the channel is zero-capacity, it acts as a rendezvous channel and a |
| 365 | + /// return value of [`Ok`] means that the data has been received. |
364 | 366 | ///
|
365 |
| - /// This method will never block the current thread. |
| 367 | + /// If the channel is full and not disconnected, this call will block until |
| 368 | + /// the send operation can proceed. If the channel becomes disconnected, |
| 369 | + /// this call will wake up and return an error. The returned error contains |
| 370 | + /// the original message. |
| 371 | + /// |
| 372 | + /// If called on a zero-capacity channel, this method will wait for a receive |
| 373 | + /// operation to appear on the other side of the channel. |
366 | 374 | ///
|
367 | 375 | /// # Examples
|
368 | 376 | ///
|
@@ -650,7 +658,7 @@ impl<T> fmt::Debug for Sender<T> {
|
650 | 658 | }
|
651 | 659 |
|
652 | 660 | /// The receiving half of Rust's [`channel`] (or [`sync_channel`]) type.
|
653 |
| -/// Different threads can share this [`Sender`] by cloning it. |
| 661 | +/// Different threads can share this [`Receiver`] by cloning it. |
654 | 662 | ///
|
655 | 663 | /// Messages sent to the channel can be retrieved using [`recv`].
|
656 | 664 | ///
|
|
0 commit comments