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