Trait strum::EnumMessage [−][src]
Associates additional pieces of information with an Enum. This can be
autoimplemented by deriving EnumMessage
and annotating your variants with
`#[strum(message=“…”)].
Example
// You need to bring the type into scope to use it!!! use strum::EnumMessage; #[derive(PartialEq, Eq, Debug, EnumMessage)] enum Pet { #[strum(message="I have a dog")] #[strum(detailed_message="My dog's name is Spots")] Dog, #[strum(message="I don't have a cat")] Cat, } let my_pet = Pet::Dog; assert_eq!("I have a dog", my_pet.get_message().unwrap());