Subscriber

Trait Subscriber 

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

    // Provided methods
    fn is_subscribed_to(&self, topic_id: &TopicId) -> bool { ... }
    fn get_subscribed_topics(&self) -> Option<Vec<TopicId>> { ... }
}
Expand description

A trait that defines a subscriber to the event bus.

Override is_subscribed_to to specify the topics the subscriber is interested in. The default implementation always returns true.

Override on_event to handle the event.

Required Methods§

Source

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

Provided Methods§

Source

fn is_subscribed_to(&self, topic_id: &TopicId) -> bool

Source

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

👎Deprecated since 3.1.0: Please use is_subscribed_to instead. Using of both methods is not recommended.

Implementors§