async-event-dispatch 0.1.1

A simple async event dispatcher that is not susceptible to the slow-receiver problem
Documentation
  • Coverage
  • 0%
    0 out of 11 items documented0 out of 10 items with examples
  • Size
  • Source code size: 15.22 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.7 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • zortax

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