You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adds conditional parsing to struct fields - both through the existing #[peek] and #[peek_with] attributes, as well as the new #[parse_if] attribute. A new section in the README gives a brief example.
To briefly elaborate on the motivation here:
A pattern that tends to come up in complex Parse implementations is having optional fields. Most of these conditions boil down to either (1) peeking, or (2) some expression based on what's already been parsed. I've already found that I wanted to allow this behavior in my personal use, so it's now a feature!
Adds enum parsing with peeking (there's a new section in the README 😄), and general tidy-up. Notably changing the generated code to use ::syn everywhere instead of syn; the former is always guaranteed to point to the crate.