Trait bonsaidb::core::pubsub::AsyncPubSub
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, Global>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn publish_bytes<'life0, 'async_trait>(
&'life0 self,
topic: Vec<u8, Global>,
payload: Vec<u8, Global>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn publish_bytes_to_all<'life0, 'async_trait>(
&'life0 self,
topics: impl IntoIterator<Item = Vec<u8, Global>> + Send + 'async_trait,
payload: Vec<u8, Global>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>
where 'life0: 'async_trait,
Self: '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, Global>>
where 'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Topic: 'async_trait + Serialize + Send + Sync,
Payload: 'async_trait + Serialize + Send + Sync,
Self: '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, Global>>
where 'topics: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Topics: 'async_trait + IntoIterator<Item = &'topics Topic> + Send + 'topics,
Topic: 'async_trait + Serialize + Send + 'topics,
Payload: 'async_trait + Serialize + Send + Sync,
Self: 'async_trait { ... }
}
Expand description
Publishes and Subscribes to messages on topics.
Required Associated Types§
type Subscriber: AsyncSubscriber
type Subscriber: AsyncSubscriber
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_bytes<'life0, 'async_trait>(
&'life0 self,
topic: Vec<u8, Global>,
payload: Vec<u8, Global>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>where
'life0: 'async_trait,
Self: 'async_trait,
fn publish_bytes<'life0, 'async_trait>( &'life0 self, topic: Vec<u8, Global>, payload: Vec<u8, Global> ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>where 'life0: 'async_trait, Self: 'async_trait,
Publishes a payload
to all subscribers of topic
.
fn publish_bytes_to_all<'life0, 'async_trait>(
&'life0 self,
topics: impl IntoIterator<Item = Vec<u8, Global>> + Send + 'async_trait,
payload: Vec<u8, Global>
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>where
'life0: 'async_trait,
Self: 'async_trait,
fn publish_bytes_to_all<'life0, 'async_trait>( &'life0 self, topics: impl IntoIterator<Item = Vec<u8, Global>> + Send + 'async_trait, payload: Vec<u8, Global> ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>where 'life0: 'async_trait, Self: 'async_trait,
Publishes a payload
to all subscribers of all topics
.
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, Global>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Topic: 'async_trait + Serialize + Send + Sync,
Payload: 'async_trait + Serialize + Send + Sync,
Self: 'async_trait,
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, Global>>where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Topic: 'async_trait + Serialize + Send + Sync, Payload: 'async_trait + Serialize + Send + Sync, Self: 'async_trait,
Publishes a payload
to all subscribers of topic
.
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, Global>>where
'topics: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Topics: 'async_trait + IntoIterator<Item = &'topics Topic> + Send + 'topics,
Topic: 'async_trait + Serialize + Send + 'topics,
Payload: 'async_trait + Serialize + Send + Sync,
Self: '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, Global>>where 'topics: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, Topics: 'async_trait + IntoIterator<Item = &'topics Topic> + Send + 'topics, Topic: 'async_trait + Serialize + Send + 'topics, Payload: 'async_trait + Serialize + Send + Sync, Self: 'async_trait,
Publishes a payload
to all subscribers of all topics
.
Implementors§
§impl AsyncPubSub for AsyncRemoteDatabase
impl AsyncPubSub for AsyncRemoteDatabase
type Subscriber = AsyncRemoteSubscriber
§impl AsyncPubSub for AsyncDatabase
impl AsyncPubSub for AsyncDatabase
type Subscriber = Subscriber
source§impl<B> AsyncPubSub for ServerDatabase<B>where
B: Backend,
impl<B> AsyncPubSub for ServerDatabase<B>where B: Backend,
Uses CustomServer
’s PubSub
relay.