Trait pliantdb_core::pubsub::PubSub[][src]

pub trait PubSub {
    type Subscriber: Subscriber;
    #[must_use]
    fn create_subscriber<'life0, 'async_trait>(
        &'life0 self
    ) -> Pin<Box<dyn Future<Output = Result<Self::Subscriber, Error>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        Self: 'async_trait
;
#[must_use] fn publish<'life0, 'life1, 'async_trait, S: Into<String> + Send, P: Serialize + Sync>(
        &'life0 self,
        topic: S,
        payload: &'life1 P
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
    where
        S: 'async_trait,
        P: 'async_trait,
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: 'async_trait
;
#[must_use] fn publish_to_all<'life0, 'life1, 'async_trait, P: Serialize + Sync>(
        &'life0 self,
        topics: Vec<String>,
        payload: &'life1 P
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
    where
        P: 'async_trait,
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: 'async_trait
; }

Publishes and Subscribes to messages on topics.

Associated Types

type Subscriber: Subscriber[src]

The Subscriber type for this PubSub connection.

Loading content...

Required methods

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

Create a new Subscriber for this relay.

#[must_use]
fn publish<'life0, 'life1, 'async_trait, S: Into<String> + Send, P: Serialize + Sync>(
    &'life0 self,
    topic: S,
    payload: &'life1 P
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where
    S: 'async_trait,
    P: 'async_trait,
    'life0: 'async_trait,
    'life1: 'async_trait,
    Self: 'async_trait, 
[src]

Publishes a payload to all subscribers of topic.

#[must_use]
fn publish_to_all<'life0, 'life1, 'async_trait, P: Serialize + Sync>(
    &'life0 self,
    topics: Vec<String>,
    payload: &'life1 P
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>> where
    P: 'async_trait,
    'life0: 'async_trait,
    'life1: 'async_trait,
    Self: 'async_trait, 
[src]

Publishes a payload to all subscribers of all topics.

Loading content...

Implementations on Foreign Types

impl PubSub for Relay[src]

type Subscriber = Subscriber

Loading content...

Implementors

Loading content...