pub struct EventTypeRouter { /* private fields */ }Expand description
Direct event-type-to-channel router for non-blocking dispatch.
Maps event_type → Sender<ContextMessage> directly (single HashMap lookup),
uses try_send() for non-blocking dispatch, and is cheaply cloneable
via Arc<HashMap> for multi-producer scenarios.
Implementations§
Source§impl EventTypeRouter
impl EventTypeRouter
Sourcepub fn dispatch(&self, event: SharedEvent) -> Result<(), DispatchError>
pub fn dispatch(&self, event: SharedEvent) -> Result<(), DispatchError>
Non-blocking dispatch via try_send().
Routes the event to the correct context channel based on event type. Returns immediately without waiting for channel capacity.
Sourcepub async fn dispatch_await(&self, event: SharedEvent) -> Result<(), String>
pub async fn dispatch_await(&self, event: SharedEvent) -> Result<(), String>
Blocking dispatch via send().await.
Waits for channel capacity if the channel is full.
Sourcepub fn dispatch_batch(&self, events: Vec<SharedEvent>) -> Vec<DispatchError>
pub fn dispatch_batch(&self, events: Vec<SharedEvent>) -> Vec<DispatchError>
Batch dispatch — non-blocking, returns errors for any events that could not be sent.
Trait Implementations§
Source§impl Clone for EventTypeRouter
impl Clone for EventTypeRouter
Source§fn clone(&self) -> EventTypeRouter
fn clone(&self) -> EventTypeRouter
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for EventTypeRouter
impl RefUnwindSafe for EventTypeRouter
impl Send for EventTypeRouter
impl Sync for EventTypeRouter
impl Unpin for EventTypeRouter
impl UnsafeUnpin for EventTypeRouter
impl UnwindSafe for EventTypeRouter
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more