Crates.io | barrage |
lib.rs | barrage |
version | 0.2.3 |
source | src |
created_at | 2020-09-13 12:42:17.493096 |
updated_at | 2022-06-21 17:11:47.551652 |
description | An async broadcast channel |
homepage | |
repository | https://github.com/Restioson/barrage |
max_upload_size | |
id | 288169 |
size | 36,819 |
A simple async broadcast channel. It is runtime agnostic and can be used from any executor. It can also operate synchronously.
#[tokio::main]
async fn main() {
let (tx, rx) = barrage::unbounded();
let rx2 = rx.clone();
tx.send_async("Hello!").await.unwrap();
assert_eq!(rx.recv_async().await, Ok("Hello!"));
assert_eq!(rx2.recv_async().await, Ok("Hello!"));
}