#enum #derive #custom-derive #macro #macro-attr

no-std enum-derive-2018

This crate provides macros for deriving additional functionality for enums

6 releases (3 stable)

1.0.2 Jul 15, 2021
1.0.1 Sep 16, 2020
0.3.1 Sep 15, 2020
0.2.1 Sep 6, 2020

#700 in Rust patterns

Download history 16/week @ 2021-06-20 40/week @ 2021-06-27 13/week @ 2021-07-04 34/week @ 2021-07-11 20/week @ 2021-07-18 18/week @ 2021-07-25 22/week @ 2021-08-01 15/week @ 2021-08-08 19/week @ 2021-08-15 23/week @ 2021-08-22 8/week @ 2021-08-29 14/week @ 2021-09-05 13/week @ 2021-09-12 24/week @ 2021-09-19 31/week @ 2021-09-26 6/week @ 2021-10-03

57 downloads per month
Used in 9 crates (3 directly)

MIT/Apache

28KB
637 lines

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:

# use macro_attr_2018::macro_attr;
# use enum_derive_2018::IterVariants;
macro_attr! {
    #[derive(Copy, Clone, Debug, IterVariants!(Vars))]
    enum ItAintRight { BabeNo, NoNo, BoyBoy }
}
# fn main() {}

can also be written as

# use macro_attr_2018::macro_attr;
# use enum_derive_2018::IterVariants;
#[derive(Copy, Clone, Debug)]
enum ItAintRight { BabeNo, NoNo, BoyBoy }

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

No runtime deps