Trait proc_macro_kwargs::parse::MacroArg [−][src]
pub trait MacroArg: Sized { fn parse_macro_arg(stream: ParseStream<'_>) -> Result<Self>; }
Expand description
A type that can be parsed as an argument to a macro.
This is often implemented by delegating to syn’s Parse.
However, sometimes it can behave differently.
For example, nested MacroKeywordArgs
require surrounding braces {}
when parsed as a MacroArg
,
but not when parsed via syn’s Parse.
This gives the effect of requiring braces when nested (as a MacroArg), but not at the top level (via syn’s Parse).
Required methods
fn parse_macro_arg(stream: ParseStream<'_>) -> Result<Self>
fn parse_macro_arg(stream: ParseStream<'_>) -> Result<Self>
Parse the argument to the macro
Implementations on Foreign Types
Parses an optional MacroArg,
always returning the Some
variant
The None
variant will only be generated
if the argument is missing