/rust/registry/src/index.crates.io-6f17d22bba15001f/regex-1.5.6/src/find_byte.rs
Line | Count | Source (jump to first uncovered line) |
1 | | /// Searches for the given needle in the given haystack. |
2 | | /// |
3 | | /// If the perf-literal feature is enabled, then this uses the super optimized |
4 | | /// memchr crate. Otherwise, it uses the naive byte-at-a-time implementation. |
5 | 0 | pub fn find_byte(needle: u8, haystack: &[u8]) -> Option<usize> { |
6 | | #[cfg(not(feature = "perf-literal"))] |
7 | | fn imp(needle: u8, haystack: &[u8]) -> Option<usize> { |
8 | | haystack.iter().position(|&b| b == needle) |
9 | | } |
10 | | |
11 | | #[cfg(feature = "perf-literal")] |
12 | 0 | fn imp(needle: u8, haystack: &[u8]) -> Option<usize> { |
13 | | use memchr::memchr; |
14 | 0 | memchr(needle, haystack) |
15 | 0 | } Unexecuted instantiation: regex::find_byte::find_byte::imp Unexecuted instantiation: regex::find_byte::find_byte::imp |
16 | | |
17 | 0 | imp(needle, haystack) |
18 | 0 | } Unexecuted instantiation: regex::find_byte::find_byte Unexecuted instantiation: regex::find_byte::find_byte |