pub fn channel<T: Clone + Send + Sync + 'static>(
capacity: usize,
) -> (Sender<T>, Receiver<T>)Expand description
Creates a broadcast channel holding the last capacity values (rounded
up to a power of two), returning a sender and a first receiver.
ยงPanics
When capacity is zero, or above usize::MAX / 2.
use nuclei::sync::broadcast;
let (tx, mut rx) = broadcast::channel::<u32>(4);
tx.send(1).unwrap();
assert_eq!(rx.try_recv(), Ok(1));