diff options
| author | Sateesh <sateeshkumarb@yahoo.com> | 2021-05-17 17:40:40 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-05-17 14:10:40 +0200 |
| commit | 399ab328d8d407265c09563aa4ef4534b2503ff2 (patch) | |
| tree | c6a2d9cfc457bc33f41517b943564f101d2ac019 /exercises/option | |
| parent | 809ec2ce01d5bc9ee0f7eae21bc9276083c8287c (diff) | |
feat: Add move_semantics5 exercise. (#746)
* feat: Add move_semantics5 exercise.
* feat: Add option3 exercise
* Address review comments. Fix typos, sentence formatting.
* Remove unwanted newline.
* Address review comments: make comment inline, fix format in print.
Diffstat (limited to 'exercises/option')
| -rw-r--r-- | exercises/option/option3.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/exercises/option/option3.rs b/exercises/option/option3.rs new file mode 100644 index 0000000..045d2ac --- /dev/null +++ b/exercises/option/option3.rs @@ -0,0 +1,19 @@ +// option3.rs +// Make me compile! Execute `rustlings hint option3` for hints + +// I AM NOT DONE + +struct Point { + x: i32, + y: i32, +} + +fn main() { + let y: Option<Point> = Some(Point { x: 100, y: 200 }); + + match y { + Some(p) => println!("Co-ordinates are {},{} ", p.x, p.y), + _ => println!("no match"), + } + y; // Fix without deleting this line. +} |
