Crate pubsub_bus

Source

Structs§

BusEvent
A struct that represents an event that can be sent over the event bus. The content is user-defined. Besudes the content, the event has an id, a source id, and a topic id.
EventBus
The Event Bus itself. Add subscribers and publishers to it.
EventEmitter
EventEmitter is a struct that can be used to publish events to the event bus. It supposed to be used by the publisher.

Traits§

Publisher
Publisher is a trait that defines a publisher to the event bus. Publisher is expected to care an EventEmitter.
Subscriber
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.