Barrage - an asynchronous broadcast channel. Each message sent will be received by every receiver. When the channel reaches its cap, send operations will block, wait, or fail (depending on which type of send was chosen). Cloned receivers will only receive messages sent after they are cloned.
let (tx, rx1) = barrage::unbounded(); let rx2 = rx1.clone(); tx.send("Hello!"); let rx3 = rx1.clone(); assert_eq!(rx1.recv(), Ok("Hello!")); assert_eq!(rx2.recv(), Ok("Hello!")); assert_eq!(rx3.try_recv(), Ok(None));
All senders have disconnected from the channel and there are no more messages waiting.
The receiver side of the channel. This will receive every message broadcast.
The future representing an asynchronous receive operation.
The future representing an asynchronous broadcast operation.
The broadcaster side of the channel.
A shared receiver is similar to a receiver, but it shares a mailbox with the other shared receivers from which it originates (was cloned from). Thus, only one shared receiver with the same mailbox will receive a broadcast.
Create a bounded channel of the given capacity.
Create a new channel with the given capacity. If
Create an unbounded channel.