Skip to content

Macro for generating enums associated with values.

License

Notifications You must be signed in to change notification settings

mira-neko/value-enum

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

value-enum docs.rs GitHub code size in bytes Crates.io Crates.io

Macro for generating enums associated with values.

Example

use value_enum::value_enum;

value_enum!(
  #[derive(Clone, Copy, PartialEq, Eq, Debug)]
  enum Abc: char {
    A = 'a',
    B = 'b',
    C = 'c',
  }
);

assert_eq!(
  char::from(Abc::A),
  'a'
);

assert_eq!(
  Abc::try_from('b'),
  Ok(Abc::B)
);

About

Macro for generating enums associated with values.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages