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.
19 lines
364 B
19 lines
364 B
|
4 years ago
|
struct Point {
|
||
|
|
x: i32,
|
||
|
|
y: i32,
|
||
|
|
}
|
||
|
|
|
||
|
|
// ANCHOR: here
|
||
|
|
fn main() {
|
||
|
|
let p = Point { x: 0, y: 7 };
|
||
|
|
|
||
|
|
match p {
|
||
|
3 years ago
|
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})");
|
||
|
|
}
|
||
|
4 years ago
|
}
|
||
|
|
}
|
||
|
|
// ANCHOR_END: here
|