https://github.com/ibraheemdev/derive-alias
Alias mutliple derives as one.
https://github.com/ibraheemdev/derive-alias
Last synced: about 1 year ago
JSON representation
Alias mutliple derives as one.
- Host: GitHub
- URL: https://github.com/ibraheemdev/derive-alias
- Owner: ibraheemdev
- License: mit
- Created: 2021-04-08T21:35:10.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2024-11-30T19:46:08.000Z (over 1 year ago)
- Last Synced: 2025-03-28T01:18:35.820Z (about 1 year ago)
- Language: Rust
- Size: 5.86 KB
- Stars: 7
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# `derive-alias`
[
](https://crates.io/crates/derive-alias)
[
](https://github.com/ibraheemdev/derive-alias)
[
](https://docs.rs/derive-alias)
Provides a way to alias mutliple derives as one.
```rust
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.
```rust
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; }
```