diff --git a/info.toml b/info.toml index 84df9111..717ea95e 100644 --- a/info.toml +++ b/info.toml @@ -175,6 +175,96 @@ path = "exercises/quiz1.rs" mode = "test" hint = "No hints this time ;)" +# PRIMITIVE TYPES + +[[exercises]] +name = "primitive_types1" +path = "exercises/primitive_types/primitive_types1.rs" +mode = "compile" +hint = "No hints this time ;)" + +[[exercises]] +name = "primitive_types2" +path = "exercises/primitive_types/primitive_types2.rs" +mode = "compile" +hint = "No hints this time ;)" + +[[exercises]] +name = "primitive_types3" +path = "exercises/primitive_types/primitive_types3.rs" +mode = "compile" +hint = """ +There's a shorthand to initialize Arrays with a certain size that does not +require you to type in 100 items (but you certainly can if you want!). +For example, you can do: +let array = ["Are we there yet?"; 10]; + +Bonus: what are some other things you could have that would return true +for `a.len() >= 100`?""" + +[[exercises]] +name = "primitive_types4" +path = "exercises/primitive_types/primitive_types4.rs" +mode = "test" +hint = """ +Take a look at the Understanding Ownership -> Slices -> Other Slices section of the book: +https://doc.rust-lang.org/book/ch04-03-slices.html +and use the starting and ending indices of the items in the Array +that you want to end up in the slice. + +If you're curious why the first argument of `assert_eq!` does not +have an ampersand for a reference since the second argument is a +reference, take a look at the coercion chapter of the nomicon: +https://doc.rust-lang.org/nomicon/coercions.html""" + +[[exercises]] +name = "primitive_types5" +path = "exercises/primitive_types/primitive_types5.rs" +mode = "compile" +hint = """ +Take a look at the Data Types -> The Tuple Type section of the book: +https://doc.rust-lang.org/book/ch03-02-data-types.html#the-tuple-type +Particularly the part about destructuring (second to last example in the section). +You'll need to make a pattern to bind `name` and `age` to the appropriate parts +of the tuple. You can do it!!""" + +[[exercises]] +name = "primitive_types6" +path = "exercises/primitive_types/primitive_types6.rs" +mode = "test" +hint = """ +While you could use a destructuring `let` for the tuple here, try +indexing into it instead, as explained in the last example of the +Data Types -> The Tuple Type section of the book: +https://doc.rust-lang.org/book/ch03-02-data-types.html#the-tuple-type +Now you have another tool in your toolbox!""" + +# VECS + +[[exercises]] +name = "vec1" +path = "exercises/collections/vec1.rs" +mode = "test" +hint = """ +In Rust, there are two ways to define a Vector. +1. One way is to use the `Vec::new()` function to create a new vector + and fill it with the `push()` method. +2. The second way, which is simpler is to use the `vec![]` macro and + define your elements inside the square brackets. +Check this chapter: https://doc.rust-lang.org/stable/book/ch08-01-vectors.html +of the Rust book to learn more. +""" + +[[exercises]] +name = "vec2" +path = "exercises/collections/vec2.rs" +mode = "test" +hint = """ +Hint 1: `i` is each element from the Vec as they are being iterated. + Can you try multiplying this? +Hint 2: Check the suggestion from the compiler error ;) +""" + # MOVE SEMANTICS [[exercises]] @@ -258,69 +348,6 @@ Can you figure out how? Another hint: it has to do with the `&` character.""" -# PRIMITIVE TYPES - -[[exercises]] -name = "primitive_types1" -path = "exercises/primitive_types/primitive_types1.rs" -mode = "compile" -hint = "No hints this time ;)" - -[[exercises]] -name = "primitive_types2" -path = "exercises/primitive_types/primitive_types2.rs" -mode = "compile" -hint = "No hints this time ;)" - -[[exercises]] -name = "primitive_types3" -path = "exercises/primitive_types/primitive_types3.rs" -mode = "compile" -hint = """ -There's a shorthand to initialize Arrays with a certain size that does not -require you to type in 100 items (but you certainly can if you want!). -For example, you can do: -let array = ["Are we there yet?"; 10]; - -Bonus: what are some other things you could have that would return true -for `a.len() >= 100`?""" - -[[exercises]] -name = "primitive_types4" -path = "exercises/primitive_types/primitive_types4.rs" -mode = "test" -hint = """ -Take a look at the Understanding Ownership -> Slices -> Other Slices section of the book: -https://doc.rust-lang.org/book/ch04-03-slices.html -and use the starting and ending indices of the items in the Array -that you want to end up in the slice. - -If you're curious why the first argument of `assert_eq!` does not -have an ampersand for a reference since the second argument is a -reference, take a look at the Deref coercions section of the book: -https://doc.rust-lang.org/book/ch15-02-deref.html""" - -[[exercises]] -name = "primitive_types5" -path = "exercises/primitive_types/primitive_types5.rs" -mode = "compile" -hint = """ -Take a look at the Data Types -> The Tuple Type section of the book: -https://doc.rust-lang.org/book/ch03-02-data-types.html#the-tuple-type -Particularly the part about destructuring (second to last example in the section). -You'll need to make a pattern to bind `name` and `age` to the appropriate parts -of the tuple. You can do it!!""" - -[[exercises]] -name = "primitive_types6" -path = "exercises/primitive_types/primitive_types6.rs" -mode = "test" -hint = """ -While you could use a destructuring `let` for the tuple here, try -indexing into it instead, as explained in the last example of the -Data Types -> The Tuple Type section of the book: -https://doc.rust-lang.org/book/ch03-02-data-types.html#the-tuple-type -Now you have another tool in your toolbox!""" # STRUCTS @@ -414,30 +441,6 @@ operator to bring these two in using only one line.""" # COLLECTIONS -[[exercises]] -name = "vec1" -path = "exercises/collections/vec1.rs" -mode = "test" -hint = """ -In Rust, there are two ways to define a Vector. -1. One way is to use the `Vec::new()` function to create a new vector - and fill it with the `push()` method. -2. The second way, which is simpler is to use the `vec![]` macro and - define your elements inside the square brackets. -Check this chapter: https://doc.rust-lang.org/stable/book/ch08-01-vectors.html -of the Rust book to learn more. -""" - -[[exercises]] -name = "vec2" -path = "exercises/collections/vec2.rs" -mode = "test" -hint = """ -Hint 1: `i` is each element from the Vec as they are being iterated. - Can you try multiplying this? -Hint 2: Check the suggestion from the compiler error ;) -""" - [[exercises]] name = "hashmap1" path = "exercises/collections/hashmap1.rs"