[−][src]Macro nom::named_attr
Makes a function from a parser combination, with attributes
The usage of this macro is almost identical to named!
, except that
you also pass attributes to be attached to the generated function.
This is ideal for adding documentation to your parser.
ⓘThis example is not tested
// Create my_function as if you wrote it with the doc comment /// My Func named_attr!(#[doc = "My Func"], my_function( &[u8] ) -> &[u8], tag!("abcd")); // Also works for pub functions, and multiple lines named!(#[doc = "My Func\nRecognise abcd"], pub my_function, tag!("abcd")); // Multiple attributes can be passed if required named!(#[doc = "My Func"] #[inline(always)], pub my_function, tag!("abcd"));