Skip to main content

memrchr

Function memrchr 

Source
pub fn memrchr<'a>(
    needle: u8,
    haystacks: impl IntoIterator<Item = &'a [u8]>,
) -> Option<usize>
Expand description

Variant of [memchr::memrchr()] for a discontiguous haystack.

Assumes byte slices are provided in reverse order, and returned byte index is from the back. For example:

let haystacks = ["123", "456"].iter().rev().map(|s| s.as_bytes());
assert_eq!(memrchr(b'4', haystacks), Some(2));