pub struct DispatchError<E> {
pub undelivered: Vec<E>,
pub source: PortError,
}Expand description
A dispatch failure that reports which events were not delivered, so a
caller can retry or persist just the remainder instead of losing track
of the whole batch.
Implementors that dispatch events one at a time should populate
undelivered with every event from the input that was not confirmed
delivered (typically the failing event and everything after it).
Implementors that dispatch atomically (all-or-nothing) should populate
it with the entire input batch on failure.
§Examples
See EventDispatcher for a worked example
of handling a DispatchError.
Fields§
§undelivered: Vec<E>Events from the input batch that were not confirmed delivered.
source: PortErrorThe underlying failure.
Implementations§
Source§impl<E> DispatchError<E>
impl<E> DispatchError<E>
Sourcepub fn new(undelivered: Vec<E>, source: PortError) -> DispatchError<E>
pub fn new(undelivered: Vec<E>, source: PortError) -> DispatchError<E>
Creates a new DispatchError.
Trait Implementations§
Source§impl<E> Debug for DispatchError<E>where
E: Debug,
impl<E> Debug for DispatchError<E>where
E: Debug,
Source§impl<E> Display for DispatchError<E>where
E: Debug,
impl<E> Display for DispatchError<E>where
E: Debug,
Source§impl<E> Error for DispatchError<E>where
E: Debug,
impl<E> Error for DispatchError<E>where
E: Debug,
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Auto Trait Implementations§
impl<E> !RefUnwindSafe for DispatchError<E>
impl<E> !UnwindSafe for DispatchError<E>
impl<E> Freeze for DispatchError<E>
impl<E> Send for DispatchError<E>where
E: Send,
impl<E> Sync for DispatchError<E>where
E: Sync,
impl<E> Unpin for DispatchError<E>where
E: Unpin,
impl<E> UnsafeUnpin for DispatchError<E>
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