pub trait AsyncPubSub: Send + Sync {
    type Subscriber: AsyncSubscriber;

    // Required methods
    fn create_subscriber<'life0, 'async_trait>(
        &'life0 self
    ) -> Pin<Box<dyn Future<Output = Result<Self::Subscriber, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn publish_bytes<'life0, 'async_trait>(
        &'life0 self,
        topic: Vec<u8>,
        payload: Vec<u8>
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn publish_bytes_to_all<'life0, 'async_trait>(
        &'life0 self,
        topics: impl 'async_trait + IntoIterator<Item = Vec<u8>> + Send,
        payload: Vec<u8>
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided methods
    fn publish<'life0, 'life1, 'life2, 'async_trait, Topic, Payload>(
        &'life0 self,
        topic: &'life1 Topic,
        payload: &'life2 Payload
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where Topic: 'async_trait + Serialize + Send + Sync,
             Payload: 'async_trait + Serialize + Send + Sync,
             Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
    fn publish_to_all<'topics, 'life0, 'life1, 'async_trait, Topics, Topic, Payload>(
        &'life0 self,
        topics: Topics,
        payload: &'life1 Payload
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
       where Topics: 'async_trait + IntoIterator<Item = &'topics Topic> + Send + 'topics,
             Topic: 'async_trait + Serialize + Send + 'topics,
             Payload: 'async_trait + Serialize + Send + Sync,
             Self: 'async_trait,
             'topics: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}
Expand description

Publishes and Subscribes to messages on topics.

Required Associated Types§

source

type Subscriber: AsyncSubscriber

The Subscriber type for this PubSub connection.

Required Methods§

source

fn create_subscriber<'life0, 'async_trait>( &'life0 self ) -> Pin<Box<dyn Future<Output = Result<Self::Subscriber, Error>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

Create a new Subscriber for this relay.

source

fn publish_bytes<'life0, 'async_trait>( &'life0 self, topic: Vec<u8>, payload: Vec<u8> ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

Publishes a payload to all subscribers of topic.

source

fn publish_bytes_to_all<'life0, 'async_trait>( &'life0 self, topics: impl 'async_trait + IntoIterator<Item = Vec<u8>> + Send, payload: Vec<u8> ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

Publishes a payload to all subscribers of all topics.

Provided Methods§

source

fn publish<'life0, 'life1, 'life2, 'async_trait, Topic, Payload>( &'life0 self, topic: &'life1 Topic, payload: &'life2 Payload ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where Topic: 'async_trait + Serialize + Send + Sync, Payload: 'async_trait + Serialize + Send + Sync, Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Publishes a payload to all subscribers of topic.

source

fn publish_to_all<'topics, 'life0, 'life1, 'async_trait, Topics, Topic, Payload>( &'life0 self, topics: Topics, payload: &'life1 Payload ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where Topics: 'async_trait + IntoIterator<Item = &'topics Topic> + Send + 'topics, Topic: 'async_trait + Serialize + Send + 'topics, Payload: 'async_trait + Serialize + Send + Sync, Self: 'async_trait, 'topics: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Publishes a payload to all subscribers of all topics.

Implementors§