How do I match enum values with an integer?

With enums, I can get an integer code like this: enum MyEnum { A = 1, B, C } ... let x = MyEnum::C as i32; but then I can't seem to do this: match x { MyEnum::A => ..., MyEnum::B ...