Features
Change #[attr_args]
to #[derive(AttrArgs)]
This changes the type of procedural macro that is used to generate the parsing logic. Since the only code that was being generated was a single impl syn::parse::Parse for Foo
, it made more sense that it should be a derive macro. This should help create more readable code when other derive macros are used on the same struct.
Adds Support for Short-Form Boolean Values
Previously when specifying a boolean parameter value within the attribute, the following syntax had to be used: #[my_attr(flag = true)]
. Now the following syntax can be used when providing a true
value for a boolean parameter: #[my_attr(flag)]
.
Bug Fixes
Panicking on Parse Failure
Previously the generated parsing logic for the attribute parameters would panic if there was an error converting from the raw parameter value to the field type of the Rust struct. This caused issues when parsing enums that were tagged with procedural macro. The code no longer panics and will instead return an error and attempt subsequent parsing logic.