We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
How to parse multiple attributes into a single struct? For example
// Library proc macro code #[derive(bae::FromAttributes)] struct Poise { name: Option<syn::LitStr>, placeholder: Option<syn::LitStr>, min_length: Option<syn::LitInt>, max_length: Option<syn::LitInt>, } // User code struct MyModal { #[poise(name = "First input label")] #[poise(placeholder = "Your first input goes here")] #[poise(min_length = 5)] #[poise(min_length = 500)] first_input: String, }
When parsing the field attributes with Poise::from_attributes(&field.attrs), only the first attributes is parsed:
Poise::from_attributes(&field.attrs)
Poise { name: Some(LitStr { token: "First input label" }), placeholder: None, min_length: None, max_length: None, paragraph: None }
I assume this is because the parser code immediately returns upon encountering the first valid attribute:
bae/src/lib.rs
Lines 165 to 173 in 3b018d1
Would a PR for parsing all valid attributes be accepted?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
How to parse multiple attributes into a single struct? For example
When parsing the field attributes with
Poise::from_attributes(&field.attrs)
, only the first attributes is parsed:I assume this is because the parser code immediately returns upon encountering the first valid attribute:
bae/src/lib.rs
Lines 165 to 173 in 3b018d1
Would a PR for parsing all valid attributes be accepted?
The text was updated successfully, but these errors were encountered: