enum Shape { Circle(int, int, int), Rectangle(int, int, int, int), Zero } fn print(s: Shape) { match s { Circle(cx, cy, r) => println!("Circle {{ {}, {}, {} }}", cx, cy, r), Rectangle(x, y, w, h) => println!("Rectangle {{ {}, {}, {}, {} }}", x, y, w, h), Zero => println!("Zero") } } fn main() { let s1 = Circle(1,2,3); let s2 = Rectangle(1,2,3,4); let s3 = Zero; let s2s = match s2 { Circle(_, _, _) => "Circle!", Rectangle(_, _, _, _) => "Rectangle!", _ => "Other" }; println!("{}", s2s); print(s1); print(s2); print(s3); }