syn
syn copied to clipboard
Document how to parse NestedMeta items from an Attribute
For parsing the parenthesized part of an attribute like #[attribute(k = "v")], parse_macro_input!(args as AttributeArgs) works when attribute is the currently expanding macro, but if attribute is just an inert attribute being parsed by some other macro then it looks a bit different. We should document this case as an example on Attribute::parse_args_with. The code will end up containing something like:
let args = attr.parse_args_with(Punctuated::<NestedMeta, Token![,]>::parse_terminated)?;