mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-16 00:00:12 +02:00
sync: update broadcast docs on allocation failure (#7352)
This commit is contained in:
@@ -500,8 +500,10 @@ const MAX_RECEIVERS: usize = usize::MAX >> 2;
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// This will panic if `capacity` is equal to `0` or larger
|
||||
/// than `usize::MAX / 2`.
|
||||
/// This will panic if `capacity` is equal to `0`.
|
||||
///
|
||||
/// This pre-allocates space for `capacity` messages. Allocation failure may result in a panic or
|
||||
/// [an allocation failure](std::alloc::handle_alloc_error).
|
||||
#[track_caller]
|
||||
pub fn channel<T: Clone>(capacity: usize) -> (Sender<T>, Receiver<T>) {
|
||||
// SAFETY: In the line below we are creating one extra receiver, so there will be 1 in total.
|
||||
|
||||
Reference in New Issue
Block a user