nom-fields 0.1.1

Provides a single function-like macro that removes some boilerplate from a common pattern when using nom.
Documentation
  • Coverage
  • 100%
    2 out of 2 items documented1 out of 1 items with examples
  • Size
  • Source code size: 4.47 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 110.79 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • Homepage
  • reslario/nom-fields
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • reslario

Docs License

nom-fields

This crate provides a single function-like macro that removes some boilerplate from a common pattern when using the parsing framework nom.

With this macro, the following parser...

nom::combinator::map(
    nom::sequence::tuple((
        some_parser,
        some_other_parser,
        a_third_parser
    )),
    |(some_field, some_other_field, a_third_field)| SomeStruct {
        some_field,
        some_other_field,
        a_third_field
    }
)(input)

...becomes this:

nom_fields::fields!(SomeStruct:
    some_field = some_parser,
    some_other_field = some_other_parser,
    a_third_field = a_third_parser
)(input)