pub trait PubSubManager {
// Required methods
fn subscribe(&mut self, sub: &Subscription) -> Fallible<()>;
fn get_subscriptions(&self) -> &Vec<Subscription>;
fn get_default_pub_socket(&self) -> &Option<ZMQSocketArc>;
// Provided methods
fn dispatch(&self, psmsg: PubSubMessage) { ... }
fn publish_to_socket<T: PubSubMessageMarker + Debug>(
&self,
msg: &T,
socket_mutex: &ZMQSocketArc,
) -> Fallible<()> { ... }
fn publish<T: PubSubMessageMarker + Debug>(&self, msg: &T) -> Fallible<()> { ... }
}Expand description
Generic traits any PUB/SUB manager should implement
Required Methods§
Sourcefn subscribe(&mut self, sub: &Subscription) -> Fallible<()>
fn subscribe(&mut self, sub: &Subscription) -> Fallible<()>
Add subscription to the manager
Sourcefn get_subscriptions(&self) -> &Vec<Subscription>
fn get_subscriptions(&self) -> &Vec<Subscription>
Return the list of subscriptons
Sourcefn get_default_pub_socket(&self) -> &Option<ZMQSocketArc>
fn get_default_pub_socket(&self) -> &Option<ZMQSocketArc>
Get the default publish socket (if available)
Provided Methods§
Sourcefn dispatch(&self, psmsg: PubSubMessage)
fn dispatch(&self, psmsg: PubSubMessage)
Dispatch message to matching subscribers
Sourcefn publish_to_socket<T: PubSubMessageMarker + Debug>(
&self,
msg: &T,
socket_mutex: &ZMQSocketArc,
) -> Fallible<()>
fn publish_to_socket<T: PubSubMessageMarker + Debug>( &self, msg: &T, socket_mutex: &ZMQSocketArc, ) -> Fallible<()>
Publish a message (anything with pubsub marker) to given socket Usually you would just use .publish() instead
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.