10 stable releases
1.2.2 | Nov 14, 2024 |
---|---|
1.2.1 | Sep 30, 2024 |
1.2.0 | May 8, 2024 |
1.1.0 | Apr 22, 2024 |
#1915 in Encoding
133 downloads per month
13KB
214 lines
Binmatch
A simple crate for binary pattern matching
Check the Docs for examples
lib.rs
:
A simple binary pattern matching library
Basic Usage looks like this:
let pattern = Pattern::new("00 __ 00 ??").unwrap();
let data = vec![0x12, 0x13, 0x00, 0x14, 0x00, 0x42, 0x15];
let matches = pattern.find_matches(data); // Or Pattern::find_matches_with_index if you need the index
assert_eq!(matches, vec![0x42]);
All needed functions can be found in [Pattern]
Usage with #![no_std]
First off, disable the default feature std
cargo add binmatch --no-default-features
The normal Pattern::new is no longer accesible, because it needs std
to function
Every time you wish to create a new [Pattern] you now have to use Pattern::new_unchecked
Dependencies
~105KB