| 1 | use craterust-analyzer cargo itertools 0.14.0 crate/::size_hintrust-analyzer cargo itertools 0.14.0 size_hint/; |
| 2 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::{ |
| 3 | fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/, |
| 4 | iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/::{DoubleEndedIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/double_ended/DoubleEndedIterator#, FusedIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/marker/FusedIterator#}, |
| 5 | }; |
| 6 | |
| 7 | pub fn flatten_okrust-analyzer cargo itertools 0.14.0 flatten_ok/flatten_ok().<I, T, E>(iter: I) -> FlattenOkrust-analyzer cargo itertools 0.14.0 flatten_ok/FlattenOk#<I, T, E> |
| 8 | where |
| 9 | I: Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<T, E>>, |
| 10 | T: IntoIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#, |
| 11 | { |
| 12 | FlattenOkrust-analyzer cargo itertools 0.14.0 flatten_ok/FlattenOk# { |
| 13 | iterrust-analyzer cargo itertools 0.14.0 flatten_ok/FlattenOk#iter., |
| 14 | inner_frontrust-analyzer cargo itertools 0.14.0 flatten_ok/FlattenOk#inner_front.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 15 | inner_backrust-analyzer cargo itertools 0.14.0 flatten_ok/FlattenOk#inner_back.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 16 | } |
| 17 | } |
| 18 | |
| 19 | /// An iterator adaptor that flattens `Result::Ok` values and |
| 20 | /// allows `Result::Err` values through unchanged. |
| 21 | /// |
| 22 | /// See [`.flatten_ok()`](crate::Itertools::flatten_ok) for more information. |
| 23 | #[must_use = "iterator adaptors are lazy and do nothing unless consumed"] |
| 24 | pub struct FlattenOkrust-analyzer cargo itertools 0.14.0 flatten_ok/FlattenOk#<I, T, E> |
| 25 | where |
| 26 | I: Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<T, E>>, |
| 27 | T: IntoIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#, |
| 28 | { |
| 29 | iterrust-analyzer cargo itertools 0.14.0 flatten_ok/FlattenOk#iter.: I, |
| 30 | inner_frontrust-analyzer cargo itertools 0.14.0 flatten_ok/FlattenOk#inner_front.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<T::IntoIterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#IntoIter#>, |
| 31 | inner_backrust-analyzer cargo itertools 0.14.0 flatten_ok/FlattenOk#inner_back.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<T::IntoIterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#IntoIter#>, |
| 32 | } |
| 33 | |
| 34 | impl<I, T, E> Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator# for FlattenOkrust-analyzer cargo itertools 0.14.0 flatten_ok/FlattenOk#<I, T, E> |
| 35 | where |
| 36 | I: Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<T, E>>, |
| 37 | T: IntoIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#, |
| 38 | { |
| 39 | type Itemrust-analyzer cargo itertools 0.14.0 flatten_ok/impl#[`FlattenOk<I, T, E>`][Iterator]Item# = Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<T::Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#Item#, E>; |
| 40 | |
| 41 | fn nextrust-analyzer cargo itertools 0.14.0 flatten_ok/impl#[`FlattenOk<I, T, E>`][Iterator]next().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Selfrust-analyzer cargo itertools 0.14.0 flatten_ok/impl#[`FlattenOk<I, T, E>`][Iterator]::Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item#> { |
| 42 | loop { |
| 43 | // Handle the front inner iterator. |
| 44 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(inner) = &mut self.inner_frontrust-analyzer cargo itertools 0.14.0 flatten_ok/FlattenOk#inner_front. { |
| 45 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(item) = inner.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#next().() { |
| 46 | return Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(item)); |
| 47 | } |
| 48 | |
| 49 | // This is necessary for the iterator to implement `FusedIterator` |
| 50 | // with only the original iterator being fused. |
| 51 | self.inner_frontrust-analyzer cargo itertools 0.14.0 flatten_ok/FlattenOk#inner_front. = Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#; |
| 52 | } |
| 53 | |
| 54 | match self.iterrust-analyzer cargo itertools 0.14.0 flatten_ok/FlattenOk#iter..nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#next().() { |
| 55 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ok)) => self.inner_frontrust-analyzer cargo itertools 0.14.0 flatten_ok/FlattenOk#inner_front. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ok.into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#into_iter().()), |
| 56 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(e)) => return Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(e)), |
| 57 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => { |
| 58 | // Handle the back inner iterator. |
| 59 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(inner) = &mut self.inner_backrust-analyzer cargo itertools 0.14.0 flatten_ok/FlattenOk#inner_back. { |
| 60 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(item) = inner.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#next().() { |
| 61 | return Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(item)); |
| 62 | } |
| 63 | |
| 64 | // This is necessary for the iterator to implement `FusedIterator` |
| 65 | // with only the original iterator being fused. |
| 66 | self.inner_backrust-analyzer cargo itertools 0.14.0 flatten_ok/FlattenOk#inner_back. = Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#; |
| 67 | } else { |
| 68 | return Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#; |
| 69 | } |
| 70 | } |
| 71 | } |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | fn foldrust-analyzer cargo itertools 0.14.0 flatten_ok/impl#[`FlattenOk<I, T, E>`][Iterator]fold().<B, F>(self, init: B, mut f: F) -> B |
| 76 | where |
| 77 | Selfrust-analyzer cargo itertools 0.14.0 flatten_ok/impl#[`FlattenOk<I, T, E>`][Iterator]: Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#, |
| 78 | F: FnMutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/FnMut#(B, Selfrust-analyzer cargo itertools 0.14.0 flatten_ok/impl#[`FlattenOk<I, T, E>`][Iterator]::Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item#) -> B, |
| 79 | { |
| 80 | // Front |
| 81 | let mut acc = match self.inner_frontrust-analyzer cargo itertools 0.14.0 flatten_ok/FlattenOk#inner_front. { |
| 82 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(x) => x.foldrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#fold().(init, |a, o| f(a, Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(o))), |
| 83 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => init, |
| 84 | }; |
| 85 | |
| 86 | acc = self.iterrust-analyzer cargo itertools 0.14.0 flatten_ok/FlattenOk#iter..foldrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#fold().(acc, |acc, x| match x { |
| 87 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(it) => it.into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#into_iter().().foldrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#fold().(acc, |a, o| f(a, Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(o))), |
| 88 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(e) => f(acc, Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(e)), |
| 89 | }); |
| 90 | |
| 91 | // Back |
| 92 | match self.inner_backrust-analyzer cargo itertools 0.14.0 flatten_ok/FlattenOk#inner_back. { |
| 93 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(x) => x.foldrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#fold().(acc, |a, o| f(a, Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(o))), |
| 94 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => acc, |
| 95 | } |
| 96 | } |
| 97 | |
| 98 | fn size_hintrust-analyzer cargo itertools 0.14.0 flatten_ok/impl#[`FlattenOk<I, T, E>`][Iterator]size_hint().(&self) -> (usize, Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<usize>) { |
| 99 | let inner_hint = |inner: &Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<T::IntoIterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#IntoIter#>| { |
| 100 | inner |
| 101 | .as_refrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]as_ref().() |
| 102 | .maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#::size_hintrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#size_hint().) |
| 103 | .unwrap_orrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap_or().((0, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(0))) |
| 104 | }; |
| 105 | let inner_front = inner_hint(&self.inner_frontrust-analyzer cargo itertools 0.14.0 flatten_ok/FlattenOk#inner_front.); |
| 106 | let inner_back = inner_hint(&self.inner_backrust-analyzer cargo itertools 0.14.0 flatten_ok/FlattenOk#inner_back.); |
| 107 | // The outer iterator `Ok` case could be (0, None) as we don't know its size_hint yet. |
| 108 | let outer = match self.iterrust-analyzer cargo itertools 0.14.0 flatten_ok/FlattenOk#iter..size_hintrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#size_hint().() { |
| 109 | (0, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(0)) => (0, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(0)), |
| 110 | _ => (0, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#), |
| 111 | }; |
| 112 | |
| 113 | size_hintrust-analyzer cargo itertools 0.14.0 size_hint/::addrust-analyzer cargo itertools 0.14.0 size_hint/add().(size_hintrust-analyzer cargo itertools 0.14.0 size_hint/::addrust-analyzer cargo itertools 0.14.0 size_hint/add().(inner_front, inner_back), outer) |
| 114 | } |
| 115 | } |
| 116 | |
| 117 | impl<I, T, E> DoubleEndedIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/double_ended/DoubleEndedIterator# for FlattenOkrust-analyzer cargo itertools 0.14.0 flatten_ok/FlattenOk#<I, T, E> |
| 118 | where |
| 119 | I: DoubleEndedIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/double_ended/DoubleEndedIterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<T, E>>, |
| 120 | T: IntoIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#, |
| 121 | T::IntoIterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#IntoIter#: DoubleEndedIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/double_ended/DoubleEndedIterator#, |
| 122 | { |
| 123 | fn next_backrust-analyzer cargo itertools 0.14.0 flatten_ok/impl#[`FlattenOk<I, T, E>`][DoubleEndedIterator]next_back().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Selfrust-analyzer cargo itertools 0.14.0 flatten_ok/impl#[`FlattenOk<I, T, E>`][DoubleEndedIterator]::Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item#> { |
| 124 | loop { |
| 125 | // Handle the back inner iterator. |
| 126 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(inner) = &mut self.inner_backrust-analyzer cargo itertools 0.14.0 flatten_ok/FlattenOk#inner_back. { |
| 127 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(item) = inner.next_backrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/double_ended/DoubleEndedIterator#next_back().() { |
| 128 | return Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(item)); |
| 129 | } |
| 130 | |
| 131 | // This is necessary for the iterator to implement `FusedIterator` |
| 132 | // with only the original iterator being fused. |
| 133 | self.inner_backrust-analyzer cargo itertools 0.14.0 flatten_ok/FlattenOk#inner_back. = Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#; |
| 134 | } |
| 135 | |
| 136 | match self.iterrust-analyzer cargo itertools 0.14.0 flatten_ok/FlattenOk#iter..next_backrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/double_ended/DoubleEndedIterator#next_back().() { |
| 137 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(ok)) => self.inner_backrust-analyzer cargo itertools 0.14.0 flatten_ok/FlattenOk#inner_back. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(ok.into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#into_iter().()), |
| 138 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(e)) => return Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(e)), |
| 139 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => { |
| 140 | // Handle the front inner iterator. |
| 141 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(inner) = &mut self.inner_frontrust-analyzer cargo itertools 0.14.0 flatten_ok/FlattenOk#inner_front. { |
| 142 | if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(item) = inner.next_backrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/double_ended/DoubleEndedIterator#next_back().() { |
| 143 | return Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(item)); |
| 144 | } |
| 145 | |
| 146 | // This is necessary for the iterator to implement `FusedIterator` |
| 147 | // with only the original iterator being fused. |
| 148 | self.inner_frontrust-analyzer cargo itertools 0.14.0 flatten_ok/FlattenOk#inner_front. = Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#; |
| 149 | } else { |
| 150 | return Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#; |
| 151 | } |
| 152 | } |
| 153 | } |
| 154 | } |
| 155 | } |
| 156 | |
| 157 | fn rfoldrust-analyzer cargo itertools 0.14.0 flatten_ok/impl#[`FlattenOk<I, T, E>`][DoubleEndedIterator]rfold().<B, F>(self, init: B, mut f: F) -> B |
| 158 | where |
| 159 | Selfrust-analyzer cargo itertools 0.14.0 flatten_ok/impl#[`FlattenOk<I, T, E>`][DoubleEndedIterator]: Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#, |
| 160 | F: FnMutrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/function/FnMut#(B, Selfrust-analyzer cargo itertools 0.14.0 flatten_ok/impl#[`FlattenOk<I, T, E>`][DoubleEndedIterator]::Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item#) -> B, |
| 161 | { |
| 162 | // Back |
| 163 | let mut acc = match self.inner_backrust-analyzer cargo itertools 0.14.0 flatten_ok/FlattenOk#inner_back. { |
| 164 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(x) => x.rfoldrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/double_ended/DoubleEndedIterator#rfold().(init, |a, o| f(a, Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(o))), |
| 165 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => init, |
| 166 | }; |
| 167 | |
| 168 | acc = self.iterrust-analyzer cargo itertools 0.14.0 flatten_ok/FlattenOk#iter..rfoldrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/double_ended/DoubleEndedIterator#rfold().(acc, |acc, x| match x { |
| 169 | Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(it) => it.into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#into_iter().().rfoldrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/double_ended/DoubleEndedIterator#rfold().(acc, |a, o| f(a, Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(o))), |
| 170 | Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(e) => f(acc, Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#(e)), |
| 171 | }); |
| 172 | |
| 173 | // Front |
| 174 | match self.inner_frontrust-analyzer cargo itertools 0.14.0 flatten_ok/FlattenOk#inner_front. { |
| 175 | Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(x) => x.rfoldrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/double_ended/DoubleEndedIterator#rfold().(acc, |a, o| f(a, Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(o))), |
| 176 | Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => acc, |
| 177 | } |
| 178 | } |
| 179 | } |
| 180 | |
| 181 | impl<I, T, E> Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone# for FlattenOkrust-analyzer cargo itertools 0.14.0 flatten_ok/FlattenOk#<I, T, E> |
| 182 | where |
| 183 | I: Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<T, E>> + Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#, |
| 184 | T: IntoIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#, |
| 185 | T::IntoIterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#IntoIter#: Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone#, |
| 186 | { |
| 187 | clone_fieldsrust-analyzer cargo itertools 0.14.0 impl_macros/clone_fields!!(iterrust-analyzer cargo itertools 0.14.0 flatten_ok/FlattenOk#iter., inner_frontrust-analyzer cargo itertools 0.14.0 flatten_ok/FlattenOk#inner_front., inner_backrust-analyzer cargo itertools 0.14.0 flatten_ok/FlattenOk#inner_back.); |
| 188 | } |
| 189 | |
| 190 | impl<I, T, E> fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug# for FlattenOkrust-analyzer cargo itertools 0.14.0 flatten_ok/FlattenOk#<I, T, E> |
| 191 | where |
| 192 | I: Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<T, E>> + fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug#, |
| 193 | T: IntoIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#, |
| 194 | T::IntoIterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#IntoIter#: fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug#, |
| 195 | { |
| 196 | debug_fmt_fieldsrust-analyzer cargo itertools 0.14.0 impl_macros/debug_fmt_fields!!(FlattenOk, iterrust-analyzer cargo itertools 0.14.0 flatten_ok/FlattenOk#iter., inner_frontrust-analyzer cargo itertools 0.14.0 flatten_ok/FlattenOk#inner_front., inner_backrust-analyzer cargo itertools 0.14.0 flatten_ok/FlattenOk#inner_back.); |
| 197 | } |
| 198 | |
| 199 | /// Only the iterator being flattened needs to implement [`FusedIterator`]. |
| 200 | impl<I, T, E> FusedIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/marker/FusedIterator# for FlattenOkrust-analyzer cargo itertools 0.14.0 flatten_ok/FlattenOk#<I, T, E> |
| 201 | where |
| 202 | I: FusedIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/marker/FusedIterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<T, E>>, |
| 203 | T: IntoIteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/collect/IntoIterator#, |
| 204 | { |
| 205 | } |