alt-enum

Crates.ioalt-enum
lib.rsalt-enum
version0.1.4
sourcesrc
created_at2022-08-26 16:59:31.789479
updated_at2022-09-02 17:49:09.402485
descriptionVarious macros providing a more beautiful syntax for enums
homepage
repositoryhttps://github.com/miralushch/alt-enum
max_upload_size
id652895
size6,040
Mira Nekomimi-Sireneva (mira-neko)

documentation

README

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~");
Commit count: 0

cargo fmt