pub trait PubSub {
type Subscriber: Subscriber;
fn create_subscriber<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Self::Subscriber, Error>> + Send + 'async_trait, Global>>
where
'life0: 'async_trait,
Self: 'async_trait;
fn publish<'life0, 'life1, 'async_trait, S, P>(
&'life0 self,
topic: S,
payload: &'life1 P
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>
where
'life0: 'async_trait,
'life1: 'async_trait,
S: Into<String> + Send + 'async_trait,
P: Serialize + Sync + 'async_trait,
Self: 'async_trait;
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>> + Send + 'async_trait, Global>>
where
'life0: 'async_trait,
'life1: 'async_trait,
P: Serialize + Sync + 'async_trait,
Self: 'async_trait;
}
Expand description
Publishes and Subscribes to messages on topics.
Associated Types
type Subscriber: Subscriber
type Subscriber: Subscriber
The Subscriber type for this PubSub
connection.
Required methods
fn create_subscriber<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Self::Subscriber, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
Self: 'async_trait,
fn create_subscriber<'life0, 'async_trait>(
&'life0 self
) -> Pin<Box<dyn Future<Output = Result<Self::Subscriber, Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
Self: 'async_trait,
Create a new Subscriber
for this relay.
fn publish<'life0, 'life1, 'async_trait, S, P>(
&'life0 self,
topic: S,
payload: &'life1 P
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
S: Into<String> + Send + 'async_trait,
P: Serialize + Sync + 'async_trait,
Self: 'async_trait,
fn publish<'life0, 'life1, 'async_trait, S, P>(
&'life0 self,
topic: S,
payload: &'life1 P
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
S: Into<String> + Send + 'async_trait,
P: Serialize + Sync + 'async_trait,
Self: 'async_trait,
Publishes a payload
to all subscribers of topic
.
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>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
P: Serialize + Sync + 'async_trait,
Self: 'async_trait,
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>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
P: Serialize + Sync + 'async_trait,
Self: 'async_trait,
Publishes a payload
to all subscribers of all topics
.