2 releases

0.1.1 Nov 30, 2024
0.1.0 Apr 8, 2021

#538 in Rust patterns

Download history 25/week @ 2024-08-26 8/week @ 2024-09-16 29/week @ 2024-09-23 13/week @ 2024-09-30 8/week @ 2024-10-07 3/week @ 2024-10-14 9/week @ 2024-11-04 4/week @ 2024-11-18 121/week @ 2024-11-25 35/week @ 2024-12-02 26/week @ 2024-12-09

186 downloads per month
Used in 2 crates

MIT license

5KB
55 lines

derive-alias

crates.io github docs.rs

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