<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body>
<pre><blockquote type="cite"><pre>2. Rust's enums look awesome but are only mostly awesome:
a. Pattern matching on them can lead to some pretty deep
indentation which is a bit annoying.
b. There's no good way to have multiple cases handled by the same
code like you can with a C switch; you have to either repeat it or
break it out into a generic helper.
</pre></blockquote>
Do you know that you can use "|" for having multiple cases handled by the same code?
enum MyEnum {
A,
B,
C
}
fn main() {
let val = MyEnum::A;
match val {
MyEnum::A | MyEnum::B => {println!("case A or case B");},
MyEnum::C => {println!("case C");}
}
}
</pre>
</body>
</html>