https://github.com/restioson/barrage
A simple async broadcast channel
https://github.com/restioson/barrage
Last synced: 8 months ago
JSON representation
A simple async broadcast channel
- Host: GitHub
- URL: https://github.com/restioson/barrage
- Owner: Restioson
- License: apache-2.0
- Created: 2020-09-11T10:55:09.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2022-06-21T17:12:16.000Z (about 4 years ago)
- Last Synced: 2024-04-24T05:03:44.458Z (about 2 years ago)
- Language: Rust
- Size: 37.1 KB
- Stars: 6
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# barrage
A simple async broadcast channel. It is runtime agnostic and can be used from any executor. It can also operate
synchronously.
## Example
```rust
#[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!"));
}
```