1 个不稳定版本
| 0.1.0 | 2022年12月31日 |
|---|
#1691 in 过程宏
34KB
197 行
matches_bytes
matches_bytes 是一个用于在字节切片中匹配字节模式的库。 matches_bytes 受Erlang的 位语法 启发。
示例
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]);
依赖关系
~1.5MB
~35K SLoC