Derive Macro NamedEnum

Source
#[derive(NamedEnum)]
{
    // Attributes available to this derive:
    #[name]
}
Expand description

Derive macro that generates name() and from_str() methods for enums based on #[type_name = "..."] attributes on the variants.

ยงExample

use slang_derive::NamedEnum;

#[derive(Debug, NamedEnum)]
enum MyEnum {
 #[name = "first_variant"]
 First,
 #[name = "second_variant"]
 Second,
 Third, // Implicit name: "third"
}