| 138 | |
| 139 | impl<T: ArrayAccessor> DoubleEndedIterator for ArrayIter<T> { |
| 140 | fn next_back(&mut self) -> Option<Self::Item> { |
| 141 | if self.current_end == self.current { |
| 142 | None |
| 143 | } else { |
| 144 | self.current_end -= 1; |
| 145 | Some(if self.is_null(self.current_end) { |
| 146 | None |
| 147 | } else { |
| 148 | // Safety: |
| 149 | // we just checked bounds in `self.current_end == self.current` |
| 150 | // this is safe on the premise that this struct is initialized with |
| 151 | // current = array.len() |
| 152 | // and that current_end is ever only decremented |
| 153 | unsafe { Some(self.array.value_unchecked(self.current_end)) } |
| 154 | }) |
| 155 | } |
| 156 | } |
| 157 | |
| 158 | #[inline] |
| 159 | fn nth_back(&mut self, n: usize) -> Option<Self::Item> { |