Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ten3roberts/derive-for
Marco for deriving the same attributes for mutliple structs
https://github.com/ten3roberts/derive-for
Last synced: about 2 months ago
JSON representation
Marco for deriving the same attributes for mutliple structs
- Host: GitHub
- URL: https://github.com/ten3roberts/derive-for
- Owner: ten3roberts
- License: mit
- Created: 2021-09-25T22:21:41.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-09-25T22:35:51.000Z (over 3 years ago)
- Last Synced: 2024-11-14T09:52:02.463Z (about 2 months ago)
- Language: Rust
- Size: 3.91 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# derive-for
A macro for defining multiple structs using the same derive procedures.The most common use case is in combination with the [`derive_more`](https://crates.io/crates/derive_more) for using the
same derives to create transparent newtypes.## Usage
```rust
derive_for!(
( Clone, Debug, PartialEq, Eq),
pub struct Foo{a: i32, name: String};
pub struct Bar(u32, u32);
);
````Clone`, `Debug`, `PartialEq`, and `Eq` will now be implemented for both
`Foo` and `Bar`. If deriving many traits for many newtypes this significantly
shortens the code.## State
This crate is very small and feature complete. If there are any issues, feel
free to open an issue.