pub struct ErrorSet { /* private fields */ }Expand description
Accumulates multiple errors so a command can process every item and report all failures at once rather than stopping at the first.
Implementations§
Source§impl ErrorSet
impl ErrorSet
pub fn new() -> Self
Sourcepub fn absorb<T>(&mut self, r: Result<T>) -> Option<T>
pub fn absorb<T>(&mut self, r: Result<T>) -> Option<T>
Record the Err of a result, returning the Ok value as an option.
Lets a loop body stay flat: if let Some(v) = set.absorb(try_thing()) { ... }
pub fn is_empty(&self) -> bool
pub fn len(&self) -> usize
pub fn errors(&self) -> &[Error]
Sourcepub fn into_result(self) -> Result<()>
pub fn into_result(self) -> Result<()>
Collapse the set into a single Result: Ok(()) if empty, otherwise an
Error summarizing the count with each failure as a note, using the
highest exit code seen.
Trait Implementations§
Auto Trait Implementations§
impl Forget for ErrorSet
impl Freeze for ErrorSet
impl Move for ErrorSet
impl RefUnwindSafe for ErrorSet
impl Send for ErrorSet
impl Sync for ErrorSet
impl Unpin for ErrorSet
impl UnsafeUnpin for ErrorSet
impl UnwindSafe for ErrorSet
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