mirror of
https://github.com/KaiserY/trpl-zh-cn
synced 2025-05-01 02:38:35 +08:00
25 lines
380 B
Rust
Executable File
25 lines
380 B
Rust
Executable File
#[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
|
|
}
|