2
0
Fork 1
mirror of https://github.com/async-rs/async-std.git synced 2025-02-16 01:09:40 +00:00

Clarify blocking in channel docs ()

This commit is contained in:
Stjepan Glavina 2019-11-03 22:19:04 +01:00 committed by GitHub
parent ddbbbfc32a
commit 78614c6c1d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -22,7 +22,7 @@ use crate::sync::WakerSet;
///
/// Senders and receivers can be cloned. When all senders associated with a channel get dropped, it
/// becomes closed. Receive operations on a closed and empty channel return `None` instead of
/// blocking.
/// trying to await a message.
///
/// # Panics
///
@ -44,7 +44,7 @@ use crate::sync::WakerSet;
/// s.send(1).await;
///
/// task::spawn(async move {
/// // This call blocks the current task because the channel is full.
/// // This call will have to wait because the channel is full.
/// // It will be able to complete only after the first message is received.
/// s.send(2).await;
/// });
@ -102,8 +102,7 @@ pub struct Sender<T> {
impl<T> Sender<T> {
/// Sends a message into the channel.
///
/// If the channel is full, this method will block the current task until the send operation
/// can proceed.
/// If the channel is full, this method will wait until there is space in the channel.
///
/// # Examples
///
@ -346,9 +345,8 @@ pub struct Receiver<T> {
impl<T> Receiver<T> {
/// Receives a message from the channel.
///
/// If the channel is empty and it still has senders, this method will block the current task
/// until the receive operation can proceed. If the channel is empty and there are no more
/// senders, this method returns `None`.
/// If the channel is empty and still has senders, this method will wait until a message is
/// sent into the channel or until all senders get dropped.
///
/// # Examples
///