We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7ec77a0 commit d7d4f7dCopy full SHA for d7d4f7d
tokio/src/sync/broadcast.rs
@@ -500,8 +500,10 @@ const MAX_RECEIVERS: usize = usize::MAX >> 2;
500
///
501
/// # Panics
502
503
-/// This will panic if `capacity` is equal to `0` or larger
504
-/// than `usize::MAX / 2`.
+/// This will panic if `capacity` is equal to `0`.
+///
505
+/// This pre-allocates space for `capacity` messages. Allocation failure may result in a panic or
506
+/// [an allocation failure](std::alloc::handle_alloc_error).
507
#[track_caller]
508
pub fn channel<T: Clone>(capacity: usize) -> (Sender<T>, Receiver<T>) {
509
// SAFETY: In the line below we are creating one extra receiver, so there will be 1 in total.
0 commit comments