(&mut self)
| 127 | <&'a V as ArrayAccessor>::Item: Default, |
| 128 | { |
| 129 | fn next_back(&mut self) -> Option<Self::Item> { |
| 130 | if self.current_back_logical == self.current_front_logical { |
| 131 | return None; |
| 132 | } |
| 133 | |
| 134 | self.current_back_logical -= 1; |
| 135 | |
| 136 | let run_ends = self.array.run_ends().values(); |
| 137 | if self.current_back_physical > 0 |
| 138 | && self.current_back_logical < run_ends[self.current_back_physical - 1].as_usize() |
| 139 | { |
| 140 | // As the run_ends is expected to be strictly increasing, there |
| 141 | // should be at least one logical entry in one physical entry. Because of this |
| 142 | // reason the next value can be accessed by decrementing physical index once. |
| 143 | self.current_back_physical -= 1; |
| 144 | } |
| 145 | Some(if self.array.values().is_null(self.current_back_physical) { |
| 146 | None |
| 147 | } else { |
| 148 | // Safety: |
| 149 | // The check `self.current_end_physical > 0` ensures the value will not underflow. |
| 150 | // Also self.current_end_physical starts with array.len() and |
| 151 | // decrements based on the bounds of self.current_end_logical. |
| 152 | unsafe { |
| 153 | Some( |
| 154 | self.array |
| 155 | .values() |
| 156 | .value_unchecked(self.current_back_physical), |
| 157 | ) |
| 158 | } |
| 159 | }) |
| 160 | } |
| 161 | } |
| 162 | |
| 163 | /// all arrays have known size. |
nothing calls this directly
no test coverage detected