#macro-derive #enums #macro #derive #custom-derive #macro-attr

no-std enum-derive-2018

This crate provides macros for deriving additional functionality for enums

11 releases (stable)

3.0.2 Sep 8, 2024
3.0.1 Jul 24, 2023
2.0.1 May 24, 2022
1.0.2 Jul 15, 2021
0.2.1 Sep 6, 2020

#1127 in Rust patterns

Download history 67/week @ 2024-07-20 108/week @ 2024-07-27 64/week @ 2024-08-03 85/week @ 2024-08-10 62/week @ 2024-08-17 72/week @ 2024-08-24 91/week @ 2024-08-31 310/week @ 2024-09-07 220/week @ 2024-09-14 203/week @ 2024-09-21 128/week @ 2024-09-28 88/week @ 2024-10-05 91/week @ 2024-10-12 139/week @ 2024-10-19 187/week @ 2024-10-26 144/week @ 2024-11-02

570 downloads per month
Used in 12 crates (3 directly)

MIT/Apache

30KB
685 lines

maintenance: actively developed

enum-derive-2018

The enum-derive modern fork.

This crate provides several macros for deriving some useful methods for unitary enums (i.e. enums where variants do not have payloads).

All of these macros are designed to be used with the macro-attr-2018 crate, though they can be used independent of it.


lib.rs:

This crate provides several macros for deriving some useful methods for unitary enums (i.e. enums where variants do not have payloads) and unary enums.

Feature flags

Using with and without macro_attr!

All of the macros are designed to be used with the macro-attr-2018 crate, though they can be used independent of it. The following:

macro_attr! {
    #[derive(Copy, Clone, Debug, IterVariants!(Vars))]
    enum ItAintRight { BabeNo, NoNo, BoyBoy }
}

can also be written as

#[derive(Copy, Clone, Debug)]
enum ItAintRight { BabeNo, NoNo, BoyBoy }

IterVariants! { (Vars) enum ItAintRight { BabeNo, NoNo, BoyBoy } }

Dependencies

~175KB