1 unstable release

0.1.0 Apr 8, 2021

#1596 in Rust patterns

Download history 7/week @ 2024-03-13 2/week @ 2024-03-20 18/week @ 2024-03-27 20/week @ 2024-04-03 26/week @ 2024-04-10 60/week @ 2024-04-17 48/week @ 2024-04-24 33/week @ 2024-05-01 69/week @ 2024-05-08 145/week @ 2024-05-15 28/week @ 2024-05-22 40/week @ 2024-05-29 35/week @ 2024-06-05 45/week @ 2024-06-12 25/week @ 2024-06-19 15/week @ 2024-06-26

125 downloads per month
Used in 2 crates

MIT license

5KB
55 lines

Derive Alias

Documentation Version License Actions

Provides a way to alias mutliple derives as one:

use derive_alias::derive_alias;

// Generates a macro (`derive_cmp`) that will attach the listed derives to a given item
derive_alias! {
    derive_cmp => #[derive(Eq, PartialEq, Ord, PartialOrd)]
}

// Attach the derives to `Foo`
derive_cmp! { struct Foo; }

You can create multiple aliases at a time:

use derive_alias::derive_alias;

derive_alias! {
    derive_cmp => #[derive(Eq, PartialEq, Ord, PartialOrd)],
    derive_other => #[derive(Copy, Clone)]
}

derive_cmp! { struct Foo; }
derive_other! { struct Bar; }

No runtime deps