match_group

Function match_group 

Source
pub fn match_group<'a, V1, T1, V2, T2>(
    start: T1,
    end: T2,
) -> impl Fn(&'a [u8]) -> ParseResult<PeekResult<T1, T2>> + 'a
where T1: Recognizable<'a, u8, V1> + Copy + 'a, T2: Recognizable<'a, u8, V2> + Copy + 'a,
Expand description

A closure that takes a slice of bytes and returns a PeekResult indicating whether the slice matches a balanced group.

A balanced group is a sequence of bytes that has the same number of start and end group tokens. The start group token is recognized by the start parameter and the end group token is recognized by the end parameter.

The closure returns Ok(PeekResult::Found { end_slice, start, end }) if the slice matches a balanced group, Ok(PeekResult::NotFound) if the slice does not match a balanced group, and Err(ParseError) if there is an error recognizing the tokens.

§Arguments

  • start - The start group token to recognize
  • end - The end group token to recognize

§Returns

A closure that takes a slice of bytes and returns a PeekResult indicating whether the slice matches a balanced group.