unsafe fn process_mask<F, T>(
    mut mask: i32,
    bytes: &[u8],
    mut offset: usize,
    callback: &mut F,
) -> Result<usize, (usize, Option<T>)>
where
    F: FnMut(usize, u8) -> LoopInstruction<Option<T>>,
{
    while mask != 0 {
        let mask_ix = mask.trailing_zeros() as usize;
        offset += mask_ix;
        match callback(offset, *bytes.get_unchecked(offset)) {
            LoopInstruction::ContinueAndSkip(skip) => {
                offset += skip + 1;
                mask >>= skip + 1 + mask_ix;
            }
            LoopInstruction::BreakAtWith(ix, val) => return Err((ix, val)),
        }
    }
    Ok(offset)
}
/// Calls the callback function for every 1 in the given bitmask with
/// the index `offset + ix`, where `ix` is the position of the 1 in the mask.
/// Returns `Ok(ix)` to continue from index `ix`, `Err((end_ix, opt_val)` to break with
/// final index `end_ix` and optional value `opt_val`.
Calls the callback function for every 1 in the given bitmask with
the index `offset + ix`, where `ix` is the position of the 1 in the mask.
Calls the callback function for every 1 in the given bitmask with the index ` offset + ix ` where ` ix ` is the position of the 1 in the mask .
unsafe fn process_mask<F, T>(
    mut mask: i32,
    bytes: &[u8],
    mut offset: usize,
    callback: &mut F,
) -> Result<usize, (usize, Option<T>)>
where
    F: FnMut(usize, u8) -> LoopInstruction<Option<T>>,
{
    while mask != 0 {
        let mask_ix = mask.trailing_zeros() as usize;
        offset += mask_ix;
        match callback(offset, *bytes.get_unchecked(offset)) {
            LoopInstruction::ContinueAndSkip(skip) => {
                offset += skip + 1;
                mask >>= skip + 1 + mask_ix;
            }
            LoopInstruction::BreakAtWith(ix, val) => return Err((ix, val)),
        }
    }
    Ok(offset)
}
unsafe fn process_mask < F , T > ( mut mask : i32 , bytes : & [ u8 ] , mut offset : usize , callback : & mut F , ) -> Result < usize , ( usize , Option < T > ) > where F : FnMut ( usize , u8 ) -> LoopInstruction < Option < T > > , { while mask != 0 { let mask_ix = mask . trailing_zeros ( ) as usize ; offset += mask_ix ; match callback ( offset , * bytes . get_unchecked ( offset ) ) { LoopInstruction :: ContinueAndSkip ( skip ) => { offset += skip + 1 ; mask >>= skip + 1 + mask_ix ; } LoopInstruction :: BreakAtWith ( ix , val ) => return Err ( ( ix , val ) ) , } } Ok ( offset ) }
Calls the callback function for every 1 in the given bitmask with
the index `offset + ix`, where `ix` is the position of the 1 in the mask.
Calls the callback function for every 1 in the given bitmask with the index ` offset + ix ` where ` ix ` is the position of the 1 in the mask .
mask
i32
bytes
&[u8]
offset
usize
callback
&mut F