vortex_array/accessor.rs
1use vortex_error::VortexResult;
2
3/// Trait for arrays that support iterative access to their elements.
4pub trait ArrayAccessor<Item: ?Sized> {
5 /// Iterate over each element of the array, in-order.
6 ///
7 /// The function `f` will be passed an [`Iterator`], it can call [`next`][Iterator::next] on the
8 /// iterator [`len`][crate::Array::len] times. Iterator elements are `Option` types,
9 /// regardless of the nullability of the underlying array data.
10 fn with_iterator<F, R>(&self, f: F) -> VortexResult<R>
11 where
12 F: for<'a> FnOnce(&mut dyn Iterator<Item = Option<&'a Item>>) -> R;
13}