#pattern-matching #binary-data #basic

no-std binmatch

A simple binary pattern matching crate

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

Download history 10/week @ 2024-09-21 157/week @ 2024-09-28 18/week @ 2024-10-05 10/week @ 2024-10-12 2/week @ 2024-10-19 7/week @ 2024-11-02 98/week @ 2024-11-09 25/week @ 2024-11-16 3/week @ 2024-11-23

133 downloads per month

MIT license

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