pub struct EitherTraversal<A, B> {
pub successes: Vec<B>,
pub error: Option<A>,
}Expand description
A traversal context for applying an Either-returning function across a collection.
Fields§
§successes: Vec<B>The accumulated successful (Left in OxiEither) results so far.
error: Option<A>The first error encountered, if any.
Implementations§
Source§impl<A, B> EitherTraversal<A, B>
impl<A, B> EitherTraversal<A, B>
Sourcepub fn step(&mut self, value: OxiEither<B, A>)
pub fn step(&mut self, value: OxiEither<B, A>)
Step the traversal with a new Either value. Once an error is set, subsequent values are ignored.
Sourcepub fn finish(self) -> OxiEither<Vec<B>, A>
pub fn finish(self) -> OxiEither<Vec<B>, A>
Finalise the traversal, consuming self.
Returns Left(successes) if no error occurred, or Right(error).
Sourcepub fn success_count(&self) -> usize
pub fn success_count(&self) -> usize
Returns the count of accumulated successes.
Trait Implementations§
Auto Trait Implementations§
impl<A, B> Freeze for EitherTraversal<A, B>where
A: Freeze,
impl<A, B> RefUnwindSafe for EitherTraversal<A, B>where
A: RefUnwindSafe,
B: RefUnwindSafe,
impl<A, B> Send for EitherTraversal<A, B>
impl<A, B> Sync for EitherTraversal<A, B>
impl<A, B> Unpin for EitherTraversal<A, B>
impl<A, B> UnsafeUnpin for EitherTraversal<A, B>where
A: UnsafeUnpin,
impl<A, B> UnwindSafe for EitherTraversal<A, B>where
A: UnwindSafe,
B: UnwindSafe,
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