devela::_dep::stringzilla::sz

Function rfind

pub fn rfind<H, N>(haystack: H, needle: N) -> Option<usize> 
where H: AsRef<[u8]>, N: AsRef<[u8]>,
Available on crate feature dep_stringzilla only.
Expand description

Locates the last matching substring within haystack that equals needle. This function is useful for finding the most recent or last occurrence of a pattern within a byte slice.

§Arguments

  • haystack: The byte slice to search.
  • needle: The byte slice to find within the haystack.

§Returns

An Option<usize> representing the starting index of the last occurrence of needle within haystack if found, otherwise None.