pub fn bounded<I, P>(cap: u64) -> (Sender<I, P>, Receiver<I, P>)where
P: Ord,
Expand description
Creates a bounded channel.
The created channel has space to hold at most cap
messages at a time.
§Panics
Capacity must be a positive number. If cap
is zero, this function will panic.
§Examples
let (s, r) = async_priority_channel::bounded(1);
assert_eq!(s.send("Foo", 0).await, Ok(()));
assert_eq!(r.recv().await, Ok(("Foo", 0)));