An open API service indexing awesome lists of open source software.

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.

Awesome Lists containing this project

README

          

# `derive-alias`

[crates.io](https://crates.io/crates/derive-alias)
[github](https://github.com/ibraheemdev/derive-alias)
[docs.rs](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; }
```