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

no-std enum-derive-2018

This crate provides macros for deriving additional functionality for enums

10 releases (stable)

3.0.1 Jul 24, 2023
3.0.0 Jul 23, 2023
2.0.1 May 24, 2022
1.0.2 Jul 15, 2021
0.2.1 Sep 6, 2020

#2259 in Rust patterns

Download history 118/week @ 2023-11-20 193/week @ 2023-11-27 159/week @ 2023-12-04 114/week @ 2023-12-11 144/week @ 2023-12-18 75/week @ 2023-12-25 95/week @ 2024-01-01 129/week @ 2024-01-08 48/week @ 2024-01-15 32/week @ 2024-01-22 8/week @ 2024-01-29 23/week @ 2024-02-05 57/week @ 2024-02-12 76/week @ 2024-02-19 154/week @ 2024-02-26 106/week @ 2024-03-04

396 downloads per month
Used in 11 crates (3 directly)

MIT/Apache

29KB
684 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.

Crate features

  • "std" Enabled by default. Disable to make the library #![no_std].

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 } }

No runtime deps