Derive Macro strum_macros::EnumIs
source · [−]#[derive(EnumIs)]
{
// Attributes available to this derive:
#[strum]
}
Expand description
Generated is_*()
methods for each variant.
E.g. Color.is_red()
.
use strum_macros::EnumIs;
#[derive(EnumIs, Debug)]
enum Color {
Red,
Green { range: usize },
}
assert!(Color::Red.is_red());
assert!(Color::Green{range: 0}.is_green());