Subscriber

Trait Subscriber 

Source
pub trait Subscriber {
    // Required methods
    fn subscribe_to_bytes(&self, topic: Vec<u8>) -> Result<(), Error>;
    fn unsubscribe_from_bytes(&self, topic: &[u8]) -> Result<(), Error>;
    fn receiver(&self) -> &Receiver ;

    // Provided methods
    fn subscribe_to<Topic: Serialize>(&self, topic: &Topic) -> Result<(), Error> { ... }
    fn unsubscribe_from<Topic: Serialize>(
        &self,
        topic: &Topic,
    ) -> Result<(), Error> { ... }
}
Expand description

A subscriber to one or more topics.

Required Methods§

Source

fn subscribe_to_bytes(&self, topic: Vec<u8>) -> Result<(), Error>

Subscribe to Messages published to topic.

Source

fn unsubscribe_from_bytes(&self, topic: &[u8]) -> Result<(), Error>

Unsubscribe from Messages published to topic.

Source

fn receiver(&self) -> &Receiver

Returns the receiver to receive Messages.

Provided Methods§

Source

fn subscribe_to<Topic: Serialize>(&self, topic: &Topic) -> Result<(), Error>

Subscribe to Messages published to topic.

Source

fn unsubscribe_from<Topic: Serialize>(&self, topic: &Topic) -> Result<(), Error>

Unsubscribe from Messages published to topic.

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.

Implementors§