pub struct InMemoryEventBus { /* private fields */ }Expand description
In-memory event bus implementation using broadcast channels
Implementations§
Source§impl InMemoryEventBus
impl InMemoryEventBus
pub fn new() -> Self
pub fn with_capacity(capacity: usize) -> Self
Trait Implementations§
Source§impl Default for InMemoryEventBus
impl Default for InMemoryEventBus
Source§impl EventBus for InMemoryEventBus
impl EventBus for InMemoryEventBus
Source§fn publish<'life0, 'async_trait>(
&'life0 self,
event: CloudEvent,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn publish<'life0, 'async_trait>(
&'life0 self,
event: CloudEvent,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Publish an event to the bus
Source§fn subscribe<'life0, 'life1, 'async_trait>(
&'life0 self,
event_type: &'life1 str,
) -> Pin<Box<dyn Future<Output = EventSubscription> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn subscribe<'life0, 'life1, 'async_trait>(
&'life0 self,
event_type: &'life1 str,
) -> Pin<Box<dyn Future<Output = EventSubscription> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Subscribe to events matching a specific type.
The subscription starts receiving events from the point of subscription.
Source§fn subscribe_all<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = EventSubscription> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn subscribe_all<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = EventSubscription> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Subscribe to all events
Source§fn unsubscribe<'life0, 'async_trait>(
&'life0 self,
_subscription: EventSubscription,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn unsubscribe<'life0, 'async_trait>(
&'life0 self,
_subscription: EventSubscription,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Unsubscribe a previously registered subscription
Source§fn recv<'life0, 'life1, 'async_trait>(
&'life0 self,
subscription: &'life1 mut EventSubscription,
) -> Pin<Box<dyn Future<Output = Option<CloudEvent>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn recv<'life0, 'life1, 'async_trait>(
&'life0 self,
subscription: &'life1 mut EventSubscription,
) -> Pin<Box<dyn Future<Output = Option<CloudEvent>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Receive the next event matching a subscription (blocking wait)
Auto Trait Implementations§
impl !Freeze for InMemoryEventBus
impl RefUnwindSafe for InMemoryEventBus
impl Send for InMemoryEventBus
impl Sync for InMemoryEventBus
impl Unpin for InMemoryEventBus
impl UnsafeUnpin for InMemoryEventBus
impl UnwindSafe for InMemoryEventBus
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more