Trait pliantdb_local::core::pubsub::PubSub[][src]

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

Create a new Subscriber for this relay.

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

Publishes a payload to all subscribers of topic.

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

Publishes a payload to all subscribers of all topics.

Loading content...

Implementors

impl PubSub for Relay[src]

type Subscriber = Subscriber

impl<DB> PubSub for Database<DB> where
    DB: Schema
[src]

type Subscriber = Subscriber

Loading content...