Function std::memchr::memrchr1.7.0 [] [src]

pub fn memrchr(needle: u8, haystack: &[u8]) -> Option<usize>

A safe interface to memrchr.

Returns the index corresponding to the last occurrence of needle in haystack, or None if one is not found.

Example

This shows how to find the last position of a byte in a byte string.

use memchr::memrchr;

let haystack = b"the quick brown fox";
assert_eq!(memrchr(b'o', haystack), Some(17));