#enums #syntax #macro #alt #debugging #val

yanked alt-enum

Various macros providing a more beautiful syntax for enums

5 releases

0.1.4 Sep 2, 2022
0.1.3 Aug 26, 2022
0.1.2 Aug 26, 2022
0.1.1 Aug 26, 2022
0.1.0 Aug 26, 2022

#9 in #val

25 downloads per month

MIT license

5KB
67 lines

alt-enum

Various macros providing more beautiful syntax for enums.

alt_enum

Macro providing a more beautiful syntax for enums.

Example

use alt_enum::alt_enum;
alt_enum!(
#[derive(Debug)]
test enum:
    first,
    second-variant,
    nyan nyan
);

assert_eq!(format!("{:?}", TestEnum::SecondVariant), "SecondVariant");

alt_val_enum

Macro providing a more beautiful syntax for enums with associated values.

(using value-enum crate, needs value_enum feature enabled)

Example

use alt_enum::alt_val_enum;
 
alt_val_enum!(
#[derive(Debug)]
some nya -> &'static str:
    first: "42",
    second-variant: "meow",
    nyan nyan: "nyaa~"
);

assert_eq!(<&str>::from(SomeNya::NyanNyan), "nyaa~");

lib.rs:

Various macros providing more beautiful syntax for enums.

Dependencies

~5KB