Function bytecount::naive_count [] [src]

pub fn naive_count(haystack: &[u8], needle: u8) -> usize

Count occurrences of a byte in a slice of bytes, simple

Example

let s = b"This is yet another Text with spaces";
let number_of_spaces = bytecount::naive_count(s, b' ');
assert_eq!(number_of_spaces, 6);