// 需要 `allow` 来消除警告,因为只使用了一个变量
#[allow(dead_code)]
enum Color {
Red,
Blue,
Green,
RGB(u32, u32, u32),
HSV(u32, u32, u32),
HSL(u32, u32, u32)
}
fn main() {
let color = Color::RGB(122, 17, 40);
println!("what color is it ?");
match color {
Color::Red => println!("The color is Red!"),
Color::RGB(a, b, c) => println!("Red: {}, green: {}, blue: {}", a, b, c),
_ => println!("unknown color")
}
}