Skip to content

A collection of useful derive macros for enums in Rust

Notifications You must be signed in to change notification settings

Revxrsal/enum-utils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

enum-utils

A small crate that provides simple derive macros for enumerations.

OrdinalEnum

#[derive(OrdinalEnum)]
pub enum AnimalType {
    Cow,  // ordinal: 0
    Cat,  // ordinal: 1
    Sheep // ordinal: 2
}

Adds ordinal() and from_ordinal() methods

NamedEnum

#[derive(NamedEnum)]
pub enum AnimalType {
    Cow,  // "Cow"
    Cat,  // "Cat"
    Sheep // "Sheep"
}

Adds name() and from_name() methods

About

A collection of useful derive macros for enums in Rust

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages