mirror of https://github.com/KaiserY/trpl-zh-cn
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
380 B
25 lines
380 B
#[derive(Debug)]
|
|
enum UsState {
|
|
Alabama,
|
|
Alaska,
|
|
// --snip--
|
|
}
|
|
|
|
enum Coin {
|
|
Penny,
|
|
Nickel,
|
|
Dime,
|
|
Quarter(UsState),
|
|
}
|
|
|
|
fn main() {
|
|
let coin = Coin::Penny;
|
|
// ANCHOR: here
|
|
let mut count = 0;
|
|
match coin {
|
|
Coin::Quarter(state) => println!("State quarter from {:?}!", state),
|
|
_ => count += 1,
|
|
}
|
|
// ANCHOR_END: here
|
|
}
|