Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: added missing exercises to info.toml #598

Merged
merged 1 commit into from
Dec 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions exercises/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
| structs | §5.1 |
| enums | §6 |
| modules | §7.2 |
| collections | §8.1 |
| strings | §8.2 |
| error_handling | §9 |
| generics | §10 |
Expand Down
63 changes: 63 additions & 0 deletions info.toml
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,52 @@ its internal structure (the `fruits` and `veggies` modules and
associated constants). It's almost there except for one keyword missing for
each constant."""

# COLLECTIONS

[[exercises]]
name = "collections1"
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 = "collections2"
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 = "collections3"
path = "exercises/collections/hashmap1.rs"
mode = "test"
hint = """
Hint 1: Take a look at the return type of the function to figure out
the type for the `basket`.
Hint 2: Number of fruits should be at least 5. And you have to put
at least three different types of fruits.
"""

[[exercises]]
name = "collections4"
path = "exercises/collections/hashmap2.rs"
mode = "test"
hint = """
Use the `entry()` and `or_insert()` methods of `HashMap` to achieve this.
Learn more at https://doc.rust-lang.org/stable/book/ch08-03-hash-maps.html#only-inserting-a-value-if-the-key-has-no-value
"""

# STRINGS

[[exercises]]
Expand Down Expand Up @@ -636,6 +682,23 @@ inside the loop but still in the main thread.
`child_numbers` should be a clone of the Arc of the numbers instead of a
thread-local copy of the numbers."""

[[exercises]]
name = "iterators1"
path = "exercises/standard_library_types/iterators1.rs"
mode = "compile"
hint = """
Step 1:
We need to apply something to the collection `my_fav_fruits` before we start to go through
it. What could that be? Take a look at the struct definition for a vector for inspiration:
https://doc.rust-lang.org/std/vec/struct.Vec.html.
Step 2 & step 2.1:
Very similar to the lines above and below. You've got this!
Step 3:
An iterator goes through all elements in a collection, but what if we've run out of
elements? What should we expect here? If you're stuck, take a look at
https://doc.rust-lang.org/std/iter/trait.Iterator.html for some ideas.
"""

[[exercises]]
name = "iterators2"
path = "exercises/standard_library_types/iterators2.rs"
Expand Down