pub struct DispatchResult { /* private fields */ }Expand description
Outcome of an event dispatch.
Carries the per-listener error list and aggregate counts. The
internal representation is lazy: a DispatchResult for a fully
successful dispatch holds an empty Vec (zero heap allocation
— Vec::new does not allocate until first push). Allocation
only happens when at least one listener returns Err or panics,
keeping the success path allocation-free.
Implementations§
Source§impl DispatchResult
impl DispatchResult
Sourcepub fn is_blocked(&self) -> bool
pub fn is_blocked(&self) -> bool
Whether the dispatch was halted by middleware.
Sourcepub fn listener_count(&self) -> usize
pub fn listener_count(&self) -> usize
Total number of listeners invoked (successes + failures).
Returns 0 when the dispatch was blocked.
Sourcepub fn success_count(&self) -> usize
pub fn success_count(&self) -> usize
Number of listeners that returned Ok(()) (or completed
without panicking).
Sourcepub fn error_count(&self) -> usize
pub fn error_count(&self) -> usize
Number of listeners that returned Err(_) or panicked. A
panicking listener contributes one error with the message
prefix "listener panicked: ".
Sourcepub fn errors(&self) -> &[ListenerError]
pub fn errors(&self) -> &[ListenerError]
Borrow every error produced by failing listeners, in dispatch order.
Sourcepub fn all_succeeded(&self) -> bool
pub fn all_succeeded(&self) -> bool
true iff the dispatch was not blocked and every listener
returned Ok(()).
Sourcepub fn has_errors(&self) -> bool
pub fn has_errors(&self) -> bool
true iff at least one listener returned Err(_) or panicked.