Crates.io | match_bytes |
lib.rs | match_bytes |
version | 0.1.0 |
source | src |
created_at | 2022-12-31 21:46:55.887798 |
updated_at | 2022-12-31 21:46:55.887798 |
description | A language extension for matching byte patterns in slices of bytes |
homepage | |
repository | |
max_upload_size | |
id | 748590 |
size | 167,077 |
matches_bytes
matches_bytes
is a library for matching byte patterns in slices of bytes. matches_bytes
is inspired by Erlang's bit sytax.
let bytes = [0, 0, 0, 1, 0, 0, 0, 0];
match_bytes!([prefix: u32 / be, rest @ ..] = &bytes);
assert_eq!(prefix, 1);
assert_eq!(*rest, [0, 0, 0, 0]);