Expand description
§Rusticata-macros
Helper macros for the rusticata project.
This crate contains some additions to nom.
For example, the combinator::cond_else
function allows to apply the first parser if the
condition is true, and the second if the condition is false:
use rusticata_macros::combinator::cond_else;
let r: IResult<_, _, ()> = cond_else(
|| s.len() > 1,
be_u16,
map(be_u8, u16::from)
)(s);
See the documentation for more details and examples.
Re-exports§
Modules§
- combinator
- General purpose combinators
- debug
- Helper functions and structures for debugging purpose
- macros
- Helper macros
Macros§
- align32
- Align input value to the next multiple of 4 bytes
- align_
n2 - Align input value to the next multiple of n bytes Valid only if n is a power of 2
- custom_
check - Helper macro for nom parsers: raise error if the condition is true
- empty
Deprecated - Helper macro for nom parsers: raise error if input is not empty
- error_
if - Helper macro for nom parsers: raise error if the condition is true
- flat_
take - Combination and flat_map! and take! as first combinator
- newtype_
enum - Helper macro for newtypes: declare associated constants and implement Display trait
- parse_
hex_ to_ u64 - Read a slice as a big-endian value.
- q
- Nom combinator that returns the given expression unchanged
- upgrade_
error - Apply combinator, trying to “upgrade” error to next error type (using the
Into
orFrom
traits). - upgrade_
error_ to - Apply combinator, trying to “upgrade” error to next error type (using the
Into
orFrom
traits).
Traits§
- Serialize
- Common trait for structures serialization