jiff::util::parse

Function slicer

Source
pub(crate) fn slicer<'a>(start: &'a [u8]) -> impl Fn(&'a [u8]) -> &'a [u8] + 'a
Expand description

Returns a function that converts two slices to the slice between them.

This takes a starting point as input and returns a function that, when given an ending point (greater than or equal to the starting point), it returns a slice beginning at the starting point and ending just at the ending point.

This is useful as a helper function in parsing routines.

§Panics

This may panic if the ending point is not a suffix slice of start.