Enums
An enum can be matched on by specifying the name of the enum and the variant.
enum Color {
Red: (),
Green: (),
Blue: (),
}
fn enum_match(input: Color) {
let result = match input {
Color::Red => 0,
Color::Green => 1,
Color::Blue => 2,
};
}