Macro find_bytes

Source
macro_rules! find_bytes {
    ( $bytes:expr; $array:expr ) => { ... };
}
Expand description

Returns a bool saying whether the given string contains the specified pattern, expressed as an array of integers slices (e.g. [&[20, 30], &[44, 65]]). Avoids all heap allocations.

ยงExamples

 
let bytes = &[20, 54, 115, 97, 97, 242];
let a = "s".as_bytes(); // 115
let b = "aa".as_bytes(); // 97, 97
assert_eq!(Some(2), find_bytes!(bytes; [a, b]));