Function xfind::find [−][src]
pub fn find<R>(needle: &[u8], rdr: &mut R) -> Option<Result<usize>> where
R: Read,
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(()) }