mirror of
https://github.com/tokio-rs/tokio.git
synced 2025-09-25 12:00:35 +00:00
sync: add panic docs for tokio::sync::broadcast::channel
(#4622)
This commit is contained in:
parent
c43832a7b1
commit
2fe49a68a4
@ -425,6 +425,11 @@ const MAX_RECEIVERS: usize = usize::MAX >> 2;
|
||||
/// tx.send(20).unwrap();
|
||||
/// }
|
||||
/// ```
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// This will panic if `capacity` is equal to `0` or larger
|
||||
/// than `usize::MAX / 2`.
|
||||
pub fn channel<T: Clone>(mut capacity: usize) -> (Sender<T>, Receiver<T>) {
|
||||
assert!(capacity > 0, "capacity is empty");
|
||||
assert!(capacity <= usize::MAX >> 1, "requested capacity too large");
|
||||
|
Loading…
x
Reference in New Issue
Block a user