Struct event::EventPublisher
[-]
[+]
[src]
pub struct EventPublisher<E> { // some fields omitted }
EventPublisher. Works similarly to C#'s event publishing pattern. Event handling functions are subscribed to the publisher.
Whenever the publisher fires an event it calls all subscribed event handler functions.
Use event::EventPublisher::
Methods
impl<E> EventPublisher<E>
fn new() -> EventPublisher<E>
Event publisher constructor.
fn subscribe_handler(&mut self, handler_box: Box<Fn(&Event<E>) + 'static>)
Subscribes event handler functions to the EventPublisher.
INPUT: handler_box: Box
fn unsubscribe_handler(&mut self, handler_box: Box<Fn(&Event<E>) + 'static>) -> bool
Unsubscribes an event handler from the publisher.
INPUT: handler_box: Box
fn publish_event(&self, event: &Event<E>)
Publishes events, pushing the &Event