Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't parse_macro_input with what used to be AttributeArgs #1463

Closed
glandium opened this issue May 30, 2023 · 3 comments
Closed

Can't parse_macro_input with what used to be AttributeArgs #1463

glandium opened this issue May 30, 2023 · 3 comments

Comments

@glandium
Copy link

The release notes for syn 2 say that AttributeArgs was removed, and says to use Punctuated<Meta, Token![,]> instead. But while parse_macro_input!(foo as AttributeArgs) worked with syn 1, the equivalent (with Punctuated<Meta, Token![,]>) doesn't work with syn 2 because ParseMacroInput is gone, and Punctuated doesn't implement Parse. How does one do the equivalent of parse_macro_input!(foo as AttributeArgs) with syn 2?

@glandium glandium changed the title Can't parse_macro_input what used to be AttributeArgs Can't parse_macro_input with what used to be AttributeArgs May 30, 2023
@vallentin
Copy link

vallentin commented May 30, 2023

You're looking for syn::meta::parser(), which includes an example able to parse:

#[tea(kind = "EarlGrey", hot, with(sugar, milk))]

@glandium
Copy link
Author

Thanks, that was useful.

@penso
Copy link

penso commented Jul 9, 2023

That was indeed useful!

Repository owner locked and limited conversation to collaborators Jul 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants