diff --git a/src/flatten_ok.rs b/src/flatten_ok.rs index 853122295..dc30e00ce 100644 --- a/src/flatten_ok.rs +++ b/src/flatten_ok.rs @@ -72,6 +72,17 @@ where } } + fn fold(self, init: B, mut f: F) -> B + where + Self: Sized, + F: FnMut(B, Self::Item) -> B, + { + self.iter.fold(init, |acc, x| match x { + Ok(it) => it.into_iter().fold(acc, |a, o| f(a, Ok(o))), + Err(e) => f(acc, Err(e)), + }) + } + fn size_hint(&self) -> (usize, Option) { let inner_hint = |inner: &Option| { inner