Attribute Macro derive
#[derive]
Expand description
Like #[macro_rules_derive]
, but for allowing to be
used to shadow the “built-in” #[derive]
attribute (on Rust ≥ 1.57.0).
That is, it is made a bit more lenient to allow for things such as:
#[macro_use]
extern crate macro_rules_attribute;
derive_alias! {
#[derive(Eq!)] = #[derive(PartialEq, Eq)];
}
#[derive(Debug, Eq!)]
struct Foo;
fn main ()
{
assert_eq!(Foo, Foo);
}
This is achieved thanks to checking for the presence of a terminating !
(or lack thereof) to determine whether the given derive macro is a classic
procedural macro one or a macro_rules!
one.