Find a sequence of bytes in a long slice of bytes
(haystack: &[u8], needle: &[u8])
| 257 | |
| 258 | /// Find a sequence of bytes in a long slice of bytes |
| 259 | pub fn find_sequence(haystack: &[u8], needle: &[u8]) -> Option<usize> { |
| 260 | haystack |
| 261 | .windows(needle.len()) |
| 262 | .position(|window| window == needle) |
| 263 | } |
| 264 | |
| 265 | /// Assert length of an EC response from the windows driver |
| 266 | /// It's always 20 more than expected. TODO: Figure out why |
no outgoing calls
no test coverage detected