simple_pubsub

Crates.iosimple_pubsub
lib.rssimple_pubsub
version0.5.3
sourcesrc
created_at2022-01-22 19:30:53.550941
updated_at2022-02-13 20:25:12.727643
descriptionA simple pubsub use dashmap and mpsc channel.
homepagehttps://github.com/tyrchen/utility-belt
repositoryhttps://github.com/tyrchen/utility-belt
max_upload_size
id519279
size8,740
Tyr Chen (tyrchen)

documentation

https://docs.rs/simple-pubsub

README

Simple Pubsub

Usage:

let topic = "lobby";
let broadcaster: Arc<Broadcaster<String>> = Arc::new(Broadcaster::default());
let (id, mut receiver) = broadcaster.clone().subscribe(topic);
broadcaster.publish(topic, Arc::new("hello world".into()));
let data = receiver.recv().await.unwrap();
assert!(id > 0);
assert_eq!(data.as_ref(), "hello world");
Commit count: 6

cargo fmt