mirror of
https://github.com/KaiserY/trpl-zh-cn
synced 2025-05-04 12:38:07 +08:00
19 lines
364 B
Rust
Executable File
19 lines
364 B
Rust
Executable File
struct Point {
|
|
x: i32,
|
|
y: i32,
|
|
}
|
|
|
|
// ANCHOR: here
|
|
fn main() {
|
|
let p = Point { x: 0, y: 7 };
|
|
|
|
match p {
|
|
Point { x, y: 0 } => println!("On the x axis at {x}"),
|
|
Point { x: 0, y } => println!("On the y axis at {y}"),
|
|
Point { x, y } => {
|
|
println!("On neither axis: ({x}, {y})");
|
|
}
|
|
}
|
|
}
|
|
// ANCHOR_END: here
|