2022-07-14 15:34:50 +00:00
|
|
|
// options3.rs
|
2023-05-29 17:39:08 +00:00
|
|
|
//
|
|
|
|
// Execute `rustlings hint options3` or use the `hint` watch subcommand for a
|
|
|
|
// hint.
|
2021-05-17 12:10:40 +00:00
|
|
|
|
|
|
|
struct Point {
|
|
|
|
x: i32,
|
|
|
|
y: i32,
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let y: Option<Point> = Some(Point { x: 100, y: 200 });
|
|
|
|
|
|
|
|
match y {
|
2024-01-29 17:49:46 +00:00
|
|
|
Some(ref p) => println!("Co-ordinates are {},{} ", p.x, p.y),
|
2023-05-09 20:13:18 +00:00
|
|
|
_ => panic!("no match!"),
|
2021-05-17 12:10:40 +00:00
|
|
|
}
|
|
|
|
y; // Fix without deleting this line.
|
|
|
|
}
|