From 64f3ba53afea73bdcc77a1d97e750bf44be1a26f Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Sun, 1 Oct 2023 22:42:51 +0200 Subject: [PATCH 1/2] sync: document broadcast capacity --- tokio/src/sync/broadcast.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tokio/src/sync/broadcast.rs b/tokio/src/sync/broadcast.rs index 42cde81dc9b..1a6f7b8b435 100644 --- a/tokio/src/sync/broadcast.rs +++ b/tokio/src/sync/broadcast.rs @@ -407,6 +407,8 @@ const MAX_RECEIVERS: usize = usize::MAX >> 2; /// Create a bounded, multi-producer, multi-consumer channel where each sent /// value is broadcasted to all active receivers. /// +/// **Note:** The actual capacity may be greater than the provided `capacity`. +/// /// All data sent on [`Sender`] will become available on every active /// [`Receiver`] in the same order as it was sent. /// @@ -474,7 +476,7 @@ unsafe impl Sync for Receiver {} impl Sender { /// Creates the sending-half of the [`broadcast`] channel. /// - /// See documentation of [`broadcast::channel`] for errors when calling this function. + /// See documentation of [`broadcast::channel`] for more information on this method. /// /// [`broadcast`]: crate::sync::broadcast /// [`broadcast::channel`]: crate::sync::broadcast From 992bfc299287f1629d75f1f65fc5f54035dc67b7 Mon Sep 17 00:00:00 2001 From: Alice Ryhl Date: Tue, 3 Oct 2023 09:37:25 +0200 Subject: [PATCH 2/2] Update tokio/src/sync/broadcast.rs Co-authored-by: Eliza Weisman --- tokio/src/sync/broadcast.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tokio/src/sync/broadcast.rs b/tokio/src/sync/broadcast.rs index 1a6f7b8b435..9618f2be310 100644 --- a/tokio/src/sync/broadcast.rs +++ b/tokio/src/sync/broadcast.rs @@ -476,7 +476,7 @@ unsafe impl Sync for Receiver {} impl Sender { /// Creates the sending-half of the [`broadcast`] channel. /// - /// See documentation of [`broadcast::channel`] for more information on this method. + /// See the documentation of [`broadcast::channel`] for more information on this method. /// /// [`broadcast`]: crate::sync::broadcast /// [`broadcast::channel`]: crate::sync::broadcast