pub trait ErrorCollector<E> {
type WrappedInner;
// Required methods
fn push_error(&mut self, error: E);
fn propagate(self, other: &mut impl ErrorCollector<E>) -> Self::WrappedInner;
}Expand description
Something which tracks a collection of errors.
This generalizes methods like ErrorSentinel::propagate which allow errors to be handled by
merging them into a different collection of errors.
Required Associated Types§
Sourcetype WrappedInner
type WrappedInner
The type returned by propagate.
Required Methods§
Sourcefn push_error(&mut self, error: E)
fn push_error(&mut self, error: E)
Add a new error to the collection of errors.
Sourcefn propagate(self, other: &mut impl ErrorCollector<E>) -> Self::WrappedInner
fn propagate(self, other: &mut impl ErrorCollector<E>) -> Self::WrappedInner
Consumes this collector and pushes all of its errors into a different collector. If the type is wrapping some kind of value, it may return it too.
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.