broadcaster

Crates.iobroadcaster
lib.rsbroadcaster
version1.0.0
sourcesrc
created_at2019-09-15 20:43:02.429914
updated_at2019-12-17 16:53:45.430946
descriptionBroadcasting futures mpmc channel
homepagehttps://github.com/leo60228/broadcaster
repositoryhttps://github.com/leo60228/broadcaster
max_upload_size
id164944
size16,118
leo60228 (leo60228)

documentation

README

broadcaster

broadcaster provides a wrapper for any Stream and Sink implementing the mpsc pattern to enable broadcasting items. This means that any item sent will be received by every receiver, not just the first to check (like most mpmc streams). As an example:

use broadcaster::BroadcastChannel;
use futures_util::StreamExt;

let mut chan = BroadcastChannel::new();
chan.send(&5i32).await?;
assert_eq!(chan.next().await, Some(5));

let mut chan2 = chan.clone();
chan2.send(&6i32).await?;
assert_eq!(chan.next().await, Some(6));
assert_eq!(chan2.next().await, Some(6));
Commit count: 27

cargo fmt