event-tools 0.1.0
Typed publish/subscribe event bus: subscribe by event type, publish, unsubscribe, one-shot handlers
Install
cargo add event-tools --registry rupm
In Ruststudio: Packages, search for event-tools, Install.
Owner: Rust Studio. Licence: MIT OR Apache-2.0. Total downloads: 0. Published 2026-11-22.
Versions
- 0.1.0 2026-11-22
README
# event-tools
Typed publish/subscribe event bus: subscribe by event type, publish, unsubscribe, one-shot handlers
Add it with `rupm add event-tools` (or `cargo add event-tools --registry rupm`).
```rust
use event_tools::EventBus;
struct UserCreated { name: String }
let bus = EventBus::new();
let id = bus.subscribe(|e: &UserCreated| println!("welcome {}", e.name));
assert_eq!(bus.publish(&UserCreated { name: "Ada".into() }), 1);
assert!(bus.unsubscribe(id));
assert_eq!(bus.publish(&UserCreated { name: "Bob".into() }), 0);
```