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.

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");}
        }
}

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to