async-event-dispatch

Crates.ioasync-event-dispatch
lib.rsasync-event-dispatch
version0.1.1
sourcesrc
created_at2023-05-11 21:08:32.588005
updated_at2023-05-11 21:08:32.588005
descriptionA simple async event dispatcher that is not susceptible to the slow-receiver problem
homepage
repository
max_upload_size
id862453
size9,023
Leonard Seibold (zortax)

documentation

README

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


Commit count: 0

cargo fmt