#macro-derive #newtype #structs #deriving #transparent #procedural #proc-macro

derive-for

Macro for defining structs using the same derive procedural macros

5 releases (2 stable)

1.2.2 Sep 25, 2021
0.2.1 Sep 25, 2021
0.1.1 Sep 25, 2021
0.1.0 Sep 25, 2021

#2326 in Rust patterns

Download history 25/week @ 2024-03-11 47/week @ 2024-03-18 65/week @ 2024-03-25 55/week @ 2024-04-01 27/week @ 2024-04-08 32/week @ 2024-04-15 36/week @ 2024-04-22 55/week @ 2024-04-29 44/week @ 2024-05-06 44/week @ 2024-05-13 51/week @ 2024-05-20 27/week @ 2024-05-27 37/week @ 2024-06-03 27/week @ 2024-06-10 33/week @ 2024-06-17 43/week @ 2024-06-24

142 downloads per month
Used in 11 crates (4 directly)

Custom license

5KB
57 lines

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 for using the same derives to create transparent newtypes.

Usage

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.

No runtime deps