fn naive_find(haystack: &[u8], needle: &[u8]) -> Option<usize> {
        if needle.is_empty() {
            return Some(0);
        } else if haystack.len() < needle.len() {
            return None;
        }
        for i in 0..(haystack.len() - needle.len() + 1) {
            if needle == &haystack[i..i + needle.len()] {
                return Some(i);
            }
        }
        None
    }
/// Naively search forwards for the given needle in the given haystack.
Naively search forwards for the given needle in the given haystack.
Naively search forwards for the given needle in the given haystack .
fn naive_find(haystack: &[u8], needle: &[u8]) -> Option<usize> {
        if needle.is_empty() {
            return Some(0);
        } else if haystack.len() < needle.len() {
            return None;
        }
        for i in 0..(haystack.len() - needle.len() + 1) {
            if needle == &haystack[i..i + needle.len()] {
                return Some(i);
            }
        }
        None
    }
fn naive_find ( haystack : & [ u8 ] , needle : & [ u8 ] ) -> Option < usize > { if needle . is_empty ( ) { return Some ( 0 ) ; } else if haystack . len ( ) < needle . len ( ) { return None ; } for i in 0 .. ( haystack . len ( ) - needle . len ( ) + 1 ) { if needle == & haystack [ i .. i + needle . len ( ) ] { return Some ( i ) ; } } None }
Naively search forwards for the given needle in the given haystack.
Naively search forwards for the given needle in the given haystack .
haystack
&[u8]
needle
&[u8]
haystack
&[u8]
needle
&[u8]