[−][src]Macro revent::hub
Generate an event hub or a derivative and its associated boilerplate code.
use revent::hub; pub trait MyTrait1 {} pub trait MyTrait2 {} hub! { MyHub { channel_name1: dyn MyTrait1, channel_name2: dyn MyTrait2, } } let mut my_hub = MyHub::default(); // or let mut my_hub = MyHub::new(); my_hub.channel_name1.emit(|_| { // Do something with each subscriber of `channel_name1`. });
The macro generates a struct of MyHub
containing all topics. Topics are public members of
the struct. See ExampleHub for an example of a generated hub.