Skip to content

Simple async event dispatcher for Rust that is not subsceptible to the slow receiver problem

License

Notifications You must be signed in to change notification settings

zortax/async-event-dispatch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

async-event-dispatch


A simple event dispatcher for Rust that is not susceptible to the slow-receiver problem.

#[derive(Clone)]
struct MyEvent(String);

let dispatcher = Dispatcher::<MyEvent>::new();
let subscriber = dispatcher.subscribe().await;

tokio::spawn(async move {
  while let Some(event) = subscriber.next().await {
    println!("Event: {}", event.0);
  }
})

dispatcher.dispatch(MyEvent("Hello World!".into())).await;

Features


About

Simple async event dispatcher for Rust that is not subsceptible to the slow receiver problem

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages