1 unstable release
0.0.1 | Apr 27, 2022 |
---|
#76 in #times
11KB
207 lines
parz
Small parser combinator library
lib.rs
:
Minimal parser combinators
Basic parsers
Items | Description | Example |
---|---|---|
[and ] |
Combine two parsers where both must succeed. | and(u16l, u32l) |
[or ] |
Combine two parsers where at least one must succeed. | or(u16l, u32l) |
take |
Take N bytes. | take(42) |
[seq ] |
Run a parser N times in sequence. | seq(u32l, 42) |
[tag ] |
Match a sequence of bytes. | tag("hello") |
[opt ] |
Allow a parser to fail. | opt(tag("hello")) |
[pod ] |
Transmute bytes into a type. Requires the bytemuck feature |
seq(pod::<MyType>, 4) |
finish |
Ensure there is no bytes left | finish(seq(u16l, 128)) |
Number parsers
u8 |
u16 |
u32 |
u64 |
u128 |
f32 |
f64 |
|
---|---|---|---|---|---|---|---|
Little Endian | byte |
u16l |
u32l |
u64l |
u128l |
f32l |
f64l |
Big Endian | byte |
u16b |
u32b |
u64b |
u128b |
f32b |
f64b |
Features
bytemuck
: Enables the [pod
] parser
MSRV
Minimum supported Rust version is: 1.60
Dependencies
~35KB