pub fn try_for_each_valid_idx<E, F>(
    len: usize,
    offset: usize,
    null_count: usize,
    nulls: Option<&[u8]>,
    f: F
) -> Result<(), E>where
    F: FnMut(usize) -> 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