mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-02 19:53:46 +00:00
20 lines
234 B
Rust
20 lines
234 B
Rust
//@ run-pass
|
|
|
|
#[derive(Debug, Eq, PartialEq)]
|
|
pub enum Type {
|
|
A,
|
|
B,
|
|
}
|
|
|
|
|
|
pub fn encode(v: Type) -> Type {
|
|
match v {
|
|
Type::A => Type::B,
|
|
_ => v,
|
|
}
|
|
}
|
|
|
|
fn main() {
|
|
assert_eq!(Type::B, encode(Type::A));
|
|
}
|