A high performance pattern scanner for bytes.
Add this crate as a dependency to your Cargo.toml
file.
toml
[dependencies]
patternscanner = "0.3.1"
```rust // Use the multithreaded pattern scanner use patternscanner::mt::pattern_scan;
// Scan for a single match of the pattern let result = patternscan( &[0x00, 0x01, 0x02, 0x33, 0x35, 0x33, 0x42, 0x07, 0x08, 0x09], "33 35", ); asserteq!(result, Some(3));
// Scan for a single match of the pattern with a wildcard let result = patternscan( &[0x00, 0x01, 0x02, 0x33, 0x35, 0x42, 0x33, 0x35, 0x69, 0x09], "33 ? 42", ); asserteq!(result, Some(3));
// Scan for all matches of the pattern with a wildcard let result = patternscanall( &[0x00, 0x01, 0x02, 0x33, 0x35, 0x42, 0x33, 0x35, 0x69, 0x09], "33 35 ?", ); assert_eq!(result, [3, 6]); ```
Contributions are welcome.