Commits


Ritchie Vink authored and Andrew Lamb committed 9178c134d16
ARROW-12337: [Rust] add DoubleEndedIterator and ExactSizeIterator traits This PR implements the traits `DoubleEndedIterator` and `ExactSizeIterator` for the arrow array iterators. For the trait `ExactSizeIterator` this is an indication of the types system that their size is known, and `DoubleEndedIterator` make them iterable in reverse order. Both include the improve of the iterators. Regarding this, I notice that the iterators check bounds twice. ```rust fn next(&mut self) -> Option<Self::Item> { let i = self.current; if i >= self.current_end { // first bounds check None } else if self.array.is_null(i) { self.current += 1; Some(None) } else { self.current += 1; Some(Some(self.array.value(i))) // second bounds check in `array.value` } } ``` In some implementations `self.array.value` includes a second bounds check. Shall I propose a PR that uses `self.array.value_unchecked`? This is safe as the bounds are already checked. Closes #9994 from ritchie46/more_iterator_traits Authored-by: Ritchie Vink <ritchie46@gmail.com> Signed-off-by: Andrew Lamb <andrew@nerdnetworks.org>