Skip to content

Latest commit

 

History

History
31 lines (20 loc) · 877 Bytes

README.md

File metadata and controls

31 lines (20 loc) · 877 Bytes

Epicenter

Simple sync/async event dispatcher for Rust

crates.io download count badge docs.rs

Usage

use epicenter::{Event, AsyncDispatcher};

#[derive(Debug, Clone)]
struct ExampleEvent {}
impl Event for ExampleEvent {}

let mut dispatcher = AsyncDispatcher::new();

dispatcher.listen(|event: ExampleEvent| async move {
    // ...
}).await;

dispatcher.dispatch(&ExampleEvent {}).await?;

Refer to the documentation on docs.rs for detailed usage instructions.

License

This project is licensed under the MIT License - see the LICENSE file for details.