• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #![allow(dead_code)]
2 
memchr(n1: u8, haystack: &[u8]) -> Option<usize>3 pub fn memchr(n1: u8, haystack: &[u8]) -> Option<usize> {
4     haystack.iter().position(|&b| b == n1)
5 }
6 
memchr2(n1: u8, n2: u8, haystack: &[u8]) -> Option<usize>7 pub fn memchr2(n1: u8, n2: u8, haystack: &[u8]) -> Option<usize> {
8     haystack.iter().position(|&b| b == n1 || b == n2)
9 }
10 
memchr3(n1: u8, n2: u8, n3: u8, haystack: &[u8]) -> Option<usize>11 pub fn memchr3(n1: u8, n2: u8, n3: u8, haystack: &[u8]) -> Option<usize> {
12     haystack.iter().position(|&b| b == n1 || b == n2 || b == n3)
13 }
14 
memrchr(n1: u8, haystack: &[u8]) -> Option<usize>15 pub fn memrchr(n1: u8, haystack: &[u8]) -> Option<usize> {
16     haystack.iter().rposition(|&b| b == n1)
17 }
18 
memrchr2(n1: u8, n2: u8, haystack: &[u8]) -> Option<usize>19 pub fn memrchr2(n1: u8, n2: u8, haystack: &[u8]) -> Option<usize> {
20     haystack.iter().rposition(|&b| b == n1 || b == n2)
21 }
22 
memrchr3(n1: u8, n2: u8, n3: u8, haystack: &[u8]) -> Option<usize>23 pub fn memrchr3(n1: u8, n2: u8, n3: u8, haystack: &[u8]) -> Option<usize> {
24     haystack.iter().rposition(|&b| b == n1 || b == n2 || b == n3)
25 }
26