#alias #derive #macro

derive-alias

将多个derive别名合并为一条

1个不稳定版本

0.1.0 2021年4月8日

#1596Rust模式

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 每月下载量
2 crates 中使用

MIT 协议

5KB
55

Derive Alias

Documentation Version License Actions

提供了一种将多个derive别名合并为一个的方法

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; }

您可以同时创建多个别名

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; }

无运行时依赖