Skip to main content

split_elements

Function split_elements 

Source
pub fn split_elements(
    octets: &[u8],
    decode: impl FnMut(&[u8], usize) -> Result<usize, Error>,
) -> Option<Vec<usize>>
Expand description

Where each element of octets ends, with decode reading the element that starts at an offset and returning the offset just past it. None when an element doesn’t decode or decode doesn’t move forward, so a value that isn’t wholly made of the elements is never half split. Empty octets split into no elements.