AsyncPubSub

Trait AsyncPubSub 

Source
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.

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§