nom-fields

Crates.ionom-fields
lib.rsnom-fields
version0.1.1
sourcesrc
created_at2020-04-06 20:00:26.334441
updated_at2020-04-09 20:55:42.604102
descriptionProvides a single function-like macro that removes some boilerplate from a common pattern when using nom.
homepagehttps://github.com/reslario/nom-fields
repositoryhttps://github.com/reslario/nom-fields
max_upload_size
id227054
size4,844
(reslario)

documentation

https://docs.rs/nom-fields/

README

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)
Commit count: 6

cargo fmt