Skip to content

Commit

Permalink
Merge #904
Browse files Browse the repository at this point in the history
904: Improve docs of channel creation functions r=taiki-e a=yjhn

Add note that the channel is multi-producer multi-consumer to the functions' docs. Also point to the parent module docs since they contain a lot of info on how to use the channel. These changes make functions' docs more self-contained (previously one needed to know to look at the module docs to discover this info).

Co-authored-by: yjhn <andrius.puksta@gmail.com>
  • Loading branch information
bors[bot] and yjhn authored Sep 11, 2022
2 parents 3e02059 + 05ed068 commit df9c824
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions crossbeam-channel/src/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ use crate::flavors;
use crate::select::{Operation, SelectHandle, Token};
use crate::utils;

/// Creates a channel of unbounded capacity.
/// Creates a multi-producer multi-consumer channel of unbounded capacity.
///
/// This channel has a growable buffer that can hold any number of messages at a time.
///
/// For more info on how to use the channel see [module level documentation](index.html).
///
/// # Examples
///
/// ```
Expand Down Expand Up @@ -54,13 +56,15 @@ pub fn unbounded<T>() -> (Sender<T>, Receiver<T>) {
(s, r)
}

/// Creates a channel of bounded capacity.
/// Creates a multi-producer multi-consumer channel of bounded capacity.
///
/// This channel has a buffer that can hold at most `cap` messages at a time.
///
/// A special case is zero-capacity channel, which cannot hold any messages. Instead, send and
/// receive operations must appear at the same time in order to pair up and pass the message over.
///
/// For more info on how to use the channel see [module level documentation](index.html).
///
/// # Examples
///
/// A channel of capacity 1:
Expand Down

0 comments on commit df9c824

Please sign in to comment.