(&mut self)
| 79 | |
| 80 | #[inline] |
| 81 | fn next(&mut self) -> Option<Self::Item> { |
| 82 | if self.current_front_logical == self.current_back_logical { |
| 83 | return None; |
| 84 | } |
| 85 | |
| 86 | // If current logical index is greater than current run end index then increment |
| 87 | // the physical index. |
| 88 | let run_ends = self.array.run_ends().values(); |
| 89 | if self.current_front_logical >= run_ends[self.current_front_physical].as_usize() { |
| 90 | // As the run_ends is expected to be strictly increasing, there |
| 91 | // should be at least one logical entry in one physical entry. Because of this |
| 92 | // reason the next value can be accessed by incrementing physical index once. |
| 93 | self.current_front_physical += 1; |
| 94 | } |
| 95 | if self.array.values().is_null(self.current_front_physical) { |
| 96 | self.current_front_logical += 1; |
| 97 | Some(None) |
| 98 | } else { |
| 99 | self.current_front_logical += 1; |
| 100 | // Safety: |
| 101 | // The self.current_physical is kept within bounds of self.current_logical. |
| 102 | // The self.current_logical will not go out of bounds because of the check |
| 103 | // `self.current_logical = self.current_end_logical` above. |
| 104 | unsafe { |
| 105 | Some(Some( |
| 106 | self.array |
| 107 | .values() |
| 108 | .value_unchecked(self.current_front_physical), |
| 109 | )) |
| 110 | } |
| 111 | } |
| 112 | } |
| 113 | |
| 114 | fn size_hint(&self) -> (usize, Option<usize>) { |
| 115 | ( |
nothing calls this directly
no test coverage detected