pub struct Gatherr<T, E>(pub Result<T, E>);Expand description
A newtype implementing FromIterator to collect into a result preserving all
error values, instead of just the first as FromIterator for Result does
let v = vec![Ok("a"), Err(1), Ok("b"), Err(2)];
let Gatherr(result): Gatherr<Vec<&str>, Vec<u32>>
= v.into_iter().collect();
assert_eq!(result, Err(vec![1, 2]));Using this directly can be awkward due to the necessary additional type annotation. Consider using the extension trait method or the freestanding gatherr function instead
Tuple Fields§
§0: Result<T, E>Trait Implementations§
Source§impl<A, B, T: FromIterator<A>, E: FromIterator<B>> FromIterator<Result<A, B>> for Gatherr<T, E>
impl<A, B, T: FromIterator<A>, E: FromIterator<B>> FromIterator<Result<A, B>> for Gatherr<T, E>
Auto Trait Implementations§
impl<T, E> Freeze for Gatherr<T, E>
impl<T, E> RefUnwindSafe for Gatherr<T, E>where
T: RefUnwindSafe,
E: RefUnwindSafe,
impl<T, E> Send for Gatherr<T, E>
impl<T, E> Sync for Gatherr<T, E>
impl<T, E> Unpin for Gatherr<T, E>
impl<T, E> UnwindSafe for Gatherr<T, E>where
T: UnwindSafe,
E: 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