Open Bromeon opened 8 months ago
I'd rather have a function like parse_macro_attribute_stream
that takes the "meta" TokenStream and returns a Result<Attribute, Err>
, but I haven't given this a lot of thought.
I'd rather have a function like
parse_macro_attribute_stream
that takes the "meta" TokenStream and returns aResult<Attribute, Err>
, but I haven't given this a lot of thought.
The Attribute
needs a name, so that would have to be passed in -- I could make a PR proposal here, should be easy to add.
That works. Just keep in mind that name wouldn't necessarily be accurate, since the actual invocation could use a path and you'd have no way to know.
It's currently not obvious how venial should be used to parse a
#[proc_macro_attribute]
macro.I typically used this pattern, where I simply treat the attribute macro as an attribute in the item.
But this is not the only usage pattern. Sometimes people don't care about the attribute, and usually they want it removed from the output.
Do you think it makes sense to provide a dedicated API for this? For example:
and
Or should we rather document different approaches and guide the user towards
parse_declaration()
?