pub trait EventPublisher {
// Required methods
fn subject(&self) -> String;
fn publish<'life0, 'life1, 'async_trait>(
&'life0 self,
event_name: impl 'async_trait + AsRef<str> + Send + Sync,
event: &'life1 (impl 'async_trait + Serialize + Send + Sync),
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn publish_bytes<'life0, 'async_trait>(
&'life0 self,
event_name: impl 'async_trait + AsRef<str> + Send + Sync,
bytes: Vec<u8>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
An EventPublisher is an object that can publish events.
Each implementation of EventPublisher will define the root subject.
Required Methods§
Sourcefn subject(&self) -> String
fn subject(&self) -> String
The base subject used for this implementation of the EventPublisher.
Sourcefn publish<'life0, 'life1, 'async_trait>(
&'life0 self,
event_name: impl 'async_trait + AsRef<str> + Send + Sync,
event: &'life1 (impl 'async_trait + Serialize + Send + Sync),
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn publish<'life0, 'life1, 'async_trait>(
&'life0 self,
event_name: impl 'async_trait + AsRef<str> + Send + Sync,
event: &'life1 (impl 'async_trait + Serialize + Send + Sync),
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Publish a single event to the event plane. The event_name will be . concatenated with the
base subject provided by the implementation.
Sourcefn publish_bytes<'life0, 'async_trait>(
&'life0 self,
event_name: impl 'async_trait + AsRef<str> + Send + Sync,
bytes: Vec<u8>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn publish_bytes<'life0, 'async_trait>(
&'life0 self,
event_name: impl 'async_trait + AsRef<str> + Send + Sync,
bytes: Vec<u8>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Publish a single event as bytes to the event plane. The event_name will be . concatenated with the
base subject provided by the implementation.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.