pub trait Bus: Send + Sync {
// Required methods
fn publish<'life0, 'async_trait>(
&'life0 self,
msg: BusMessage,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn subscribe<'life0, 'life1, 'async_trait>(
&'life0 self,
topic: &'life1 str,
handler: Box<dyn Fn(BusMessage) -> Pin<Box<dyn Future<Output = ()> + Send>> + Send + Sync>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn start<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn stop<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Trait for message bus backends
Required Methods§
Sourcefn publish<'life0, 'async_trait>(
&'life0 self,
msg: BusMessage,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn publish<'life0, 'async_trait>(
&'life0 self,
msg: BusMessage,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Publish a message to a topic
Sourcefn subscribe<'life0, 'life1, 'async_trait>(
&'life0 self,
topic: &'life1 str,
handler: Box<dyn Fn(BusMessage) -> Pin<Box<dyn Future<Output = ()> + Send>> + Send + Sync>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn subscribe<'life0, 'life1, 'async_trait>(
&'life0 self,
topic: &'life1 str,
handler: Box<dyn Fn(BusMessage) -> Pin<Box<dyn Future<Output = ()> + Send>> + Send + Sync>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Subscribe to a topic with a handler