Trait Subscriber

Source
pub trait Subscriber<ContentType, TopicId>: Send + Sync {
    // Required method
    fn on_event(&mut self, event: &BusEvent<ContentType, TopicId>);

    // Provided method
    fn get_subscribed_topics(&self) -> Option<Vec<TopicId>> { ... }
}
Expand description

A trait that defines a subscriber to the event bus. Override get_subscribed_topics to return a list of topics the subscriber is interested in. If the subscriber is interested in all topics, thre si a default implementation that returns None. Override on_event to handle the event.

Required Methods§

Source

fn on_event(&mut self, event: &BusEvent<ContentType, TopicId>)

Provided Methods§

Source

fn get_subscribed_topics(&self) -> Option<Vec<TopicId>>

Implementors§