arrow_buffer::bit_iterator

Function try_for_each_valid_idx

Source
pub fn try_for_each_valid_idx<E, F: FnMut(usize) -> Result<(), E>>(
    len: usize,
    offset: usize,
    null_count: usize,
    nulls: Option<&[u8]>,
    f: F,
) -> Result<(), E>
Expand description

Calls the provided closure for each index in the provided null mask that is set, using an adaptive strategy based on the null count

Ideally this would be encapsulated in an Iterator that would determine the optimal strategy up front, and then yield indexes based on this.

Unfortunately, external iteration based on the resulting Iterator would match the strategy variant on each call to Iterator::next, and LLVM generally cannot eliminate this.

One solution to this might be internal iteration, e.g. Iterator::try_fold, however, it is currently not possible to override this for custom iterators in stable Rust.

As such this is the next best option