Skip to content

provide a simple way to convert enum to &'static str

Notifications You must be signed in to change notification settings

DCjanus/enum_to_str_derive

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Latest Version License Build state

example

main.rs

#[macro_use]
extern crate enum_to_str_derive;

#[derive(EnumToStr)]
enum Foo {
    Foo,
    #[ETS(value = r#"Can you please tell me what does "foo" mean"#)]
    Question,
}

fn main() {
    debug_assert_eq!("Foo", Foo::Foo.enum_to_str());
    debug_assert_eq!(
        r#"Can you please tell me what does "foo" mean"#,
        Foo::Question.enum_to_str()
    );
}

TODO

  • add attribute: value
  • add attribute: handler

About

provide a simple way to convert enum to &'static str

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages