Function xfind::rfind[][src]

pub fn rfind<R>(needle: &[u8], rdr: &mut R) -> Option<Result<usize>> where
    R: Read + Seek
Expand description

Returns the index of the last occurrence of the given needle in the stream.

Examples

use std::io::{self, Cursor};

fn main() -> io::Result<()> {
    let mut stream = Cursor::new(b"rusty rust");

    let pos = xfind::rfind(b"rust", &mut stream).transpose()?;
    assert_eq!(pos, Some(6));

    Ok(())
}