2018-12-16 22:21:47 -05:00
|
|
|
enum Color { Rgb(isize, isize, isize), Rgba(isize, isize, isize, isize), }
|
2010-06-23 21:03:09 -07:00
|
|
|
|
2011-07-27 14:19:39 +02:00
|
|
|
fn main() {
|
2018-12-16 22:21:47 -05:00
|
|
|
let red: Color = Color::Rgb(255, 0, 0);
|
2012-08-06 12:34:08 -07:00
|
|
|
match red {
|
2018-12-07 18:15:36 +00:00
|
|
|
Color::Rgb(r, g, b) => { println!("rgb"); }
|
|
|
|
Color::Hsl(h, s, l) => { println!("hsl"); }
|
|
|
|
//~^ ERROR no variant
|
2011-12-22 14:42:52 -08:00
|
|
|
}
|
2010-06-23 21:03:09 -07:00
|
|
|
}
|