Macro nom::named_attr [−][src]
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.
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_attr!(#[doc = "My Func\nRecognise abcd"], pub my_function, tag!("abcd"));
Multiple attributes can be passed if required:
named_attr!(#[doc = "My Func"] #[inline(always)], pub my_function, tag!("abcd"));