Function xfind::find [−][src]
Expand description
Returns the index of the first 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::find(b"rust", &mut stream).transpose()?;
assert_eq!(pos, Some(0));
Ok(())
}