diff --git a/exercises/option/README.md b/exercises/options/README.md similarity index 99% rename from exercises/option/README.md rename to exercises/options/README.md index 89c0028..6140a16 100644 --- a/exercises/option/README.md +++ b/exercises/options/README.md @@ -1,4 +1,4 @@ -# Option +# Options Type Option represents an optional value: every Option is either Some and contains a value, or None, and does not. Option types are very common in Rust code, as they have a number of uses: diff --git a/exercises/option/option1.rs b/exercises/options/options1.rs similarity index 81% rename from exercises/option/option1.rs rename to exercises/options/options1.rs index 17cf4f6..9d96817 100644 --- a/exercises/option/option1.rs +++ b/exercises/options/options1.rs @@ -1,5 +1,5 @@ -// option1.rs -// Make me compile! Execute `rustlings hint option1` for hints +// options1.rs +// Execute `rustlings hint options1` or use the `hint` watch subcommand for a hint. // I AM NOT DONE diff --git a/exercises/option/option2.rs b/exercises/options/options2.rs similarity index 98% rename from exercises/option/option2.rs rename to exercises/options/options2.rs index c6b83ec..a1c21d3 100644 --- a/exercises/option/option2.rs +++ b/exercises/options/options2.rs @@ -1,4 +1,4 @@ -// option2.rs +// options2.rs // Make me compile! Execute `rustlings hint option2` for hints // I AM NOT DONE diff --git a/exercises/option/option3.rs b/exercises/options/options3.rs similarity index 96% rename from exercises/option/option3.rs rename to exercises/options/options3.rs index 045d2ac..4cba4ad 100644 --- a/exercises/option/option3.rs +++ b/exercises/options/options3.rs @@ -1,4 +1,4 @@ -// option3.rs +// options3.rs // Make me compile! Execute `rustlings hint option3` for hints // I AM NOT DONE diff --git a/info.toml b/info.toml index 0a94f7d..6bcf278 100644 --- a/info.toml +++ b/info.toml @@ -531,6 +531,48 @@ path = "exercises/quiz2.rs" mode = "test" hint = "No hints this time ;)" +# OPTIONS + +[[exercises]] +name = "options1" +path = "exercises/options/options1.rs" +mode = "compile" +hint = """ +Hint 1: Check out some functions of Option: +is_some +is_none +unwrap + +and: +pattern matching + +Hint 2: There are no sensible defaults for the value of an Array; the values need to be filled before use. +""" + +[[exercises]] +name = "options2" +path = "exercises/options/options2.rs" +mode = "compile" +hint = """ +check out: +https://doc.rust-lang.org/rust-by-example/flow_control/if_let.html +https://doc.rust-lang.org/rust-by-example/flow_control/while_let.html + +Remember that Options can be stacked in if let and while let. +For example: Some(Some(variable)) = variable2 +Also see Option::flatten +""" + +[[exercises]] +name = "options3" +path = "exercises/options/options3.rs" +mode = "compile" +hint = """ +The compiler says a partial move happened in the `match` +statement. How can this be avoided? The compiler shows the correction +needed. After making the correction as suggested by the compiler, do +read: https://doc.rust-lang.org/std/keyword.ref.html""" + # ERROR HANDLING [[exercises]] @@ -661,48 +703,6 @@ ReportCard struct generic, but also the correct property - you will need to chan of the struct slightly too...you can do it! """ -# OPTIONS - -[[exercises]] -name = "option1" -path = "exercises/option/option1.rs" -mode = "compile" -hint = """ -Hint 1: Check out some functions of Option: -is_some -is_none -unwrap - -and: -pattern matching - -Hint 2: There are no sensible defaults for the value of an Array; the values need to be filled before use. -""" - -[[exercises]] -name = "option2" -path = "exercises/option/option2.rs" -mode = "compile" -hint = """ -check out: -https://doc.rust-lang.org/rust-by-example/flow_control/if_let.html -https://doc.rust-lang.org/rust-by-example/flow_control/while_let.html - -Remember that Options can be stacked in if let and while let. -For example: Some(Some(variable)) = variable2 -Also see Option::flatten -""" - -[[exercises]] -name = "option3" -path = "exercises/option/option3.rs" -mode = "compile" -hint = """ -The compiler says a partial move happened in the `match` -statement. How can this be avoided? The compiler shows the correction -needed. After making the correction as suggested by the compiler, do -read: https://doc.rust-lang.org/std/keyword.ref.html""" - # TRAITS [[exercises]]