v0.3.0
Features
Tagged Tuple Structs
Tuple structs can now be tagged with #[attr_args] which allows for attributes using unnamed parameters.
Example
#[attr_args]
struct Foo (String);
#[foo("Value")]
fn bar() {
//...
}Tagged Enums
Now users can use the #[attr_args] attribute on enums to allow for custom attributes that have multiple forms.
Example
#[attr_args]
enum Foo {
Both { first: String, second: String },
FirstOnly { first: String },
UnnamedFirstOnly(String),
SecondOnly { second: String }
}
#[foo(first = "First", second = "Second")] // Valid
#[foo(first = "First")] // Valid
#[foo("First")] // Valid
#[foo(second = "Second")] // Valid
#[foo()] // Invalid
fn bar() {
//...
}