# EventDispatcher A simple library to register listeners for specific events inspired by [rust-emitter](https://github.com/reem/rust-emitter). ## Usage example ```rust extern crate event_dispatcher; use event_dispatcher::{Event, Listener, Dispatcher, Dispatchable}; struct TestEvent { stopped: bool, data: String } impl TestEvent { pub fn new(event_data: String) -> TestEvent { TestEvent { stopped: false, data: event_data } } } impl Event for TestEvent { fn is_propagation_stopped(&self) -> bool{ self.stopped } fn stop_propagation(&mut self){ self.stopped = true; } } // the listener fn event_test(event: &TestEvent) { println!("called \"event_test\""); } fn main() { let event = TestEvent::new("my_event".to_string()); let mut dispatcher = Dispatcher::new(); dispatcher.add_listener(&event, Listener::new(my_event_test)); dispatcher.dispatch(&event); } ```