feat(iterators): update hint comments

pull/1060/head
mokou 2 years ago
parent 251d0dda34
commit 20024d40c5

@ -6,7 +6,7 @@
// This module helps you get familiar with the structure of using an iterator and
// how to go through elements within an iterable collection.
//
// Execute `rustlings hint iterators1` for hints :D
// Execute `rustlings hint iterators1` or use the `hint` watch subcommand for a hint.
// I AM NOT DONE

@ -1,7 +1,7 @@
// iterators2.rs
// In this exercise, you'll learn some of the unique advantages that iterators
// can offer. Follow the steps to complete the exercise.
// As always, there are hints if you execute `rustlings hint iterators2`!
// Execute `rustlings hint iterators2` or use the `hint` watch subcommand for a hint.
// I AM NOT DONE

@ -4,7 +4,7 @@
// 1. Complete the divide function to get the first four tests to pass.
// 2. Get the remaining tests to pass by completing the result_with_list and
// list_of_results functions.
// Execute `rustlings hint iterators3` to get some hints!
// Execute `rustlings hint iterators3` or use the `hint` watch subcommand for a hint.
// I AM NOT DONE

@ -1,4 +1,5 @@
// iterators4.rs
// Execute `rustlings hint iterators4` or use the `hint` watch subcommand for a hint.
// I AM NOT DONE

@ -6,7 +6,7 @@
// imperative style for loops. Recreate this counting functionality using
// iterators. Only the two iterator methods (count_iterator and
// count_collection_iterator) need to be modified.
// Execute `rustlings hint iterators5` for hints.
// Execute `rustlings hint iterators5` or use the `hint` watch subcommand for a hint.
//
// Make the code compile and the tests pass.
@ -34,6 +34,7 @@ fn count_for(map: &HashMap<String, Progress>, value: Progress) -> usize {
fn count_iterator(map: &HashMap<String, Progress>, value: Progress) -> usize {
// map is a hashmap with String keys and Progress values.
// map = { "variables1": Complete, "from_str": None, ... }
todo!();
}
fn count_collection_for(collection: &[HashMap<String, Progress>], value: Progress) -> usize {
@ -52,6 +53,7 @@ fn count_collection_iterator(collection: &[HashMap<String, Progress>], value: Pr
// collection is a slice of hashmaps.
// collection = [{ "variables1": Complete, "from_str": None, ... },
// { "variables2": Complete, ... }, ... ]
todo!();
}
#[cfg(test)]

@ -802,7 +802,8 @@ case is a vector of integers and the failure case is a DivisionError.
The list_of_results function needs to return a vector of results.
See https://doc.rust-lang.org/std/iter/trait.Iterator.html#method.collect for how
the `FromIterator` trait is used in `collect()`."""
the `FromIterator` trait is used in `collect()`. This trait is REALLY powerful! It
can make the solution to this exercise infinitely easier."""
[[exercises]]
name = "iterators4"
@ -812,7 +813,9 @@ hint = """
In an imperative language, you might write a for loop that updates
a mutable variable. Or, you might write code utilizing recursion
and a match clause. In Rust you can take another functional
approach, computing the factorial elegantly with ranges and iterators."""
approach, computing the factorial elegantly with ranges and iterators.
Hint 2: Check out the `fold` and `rfold` methods!"""
[[exercises]]
name = "iterators5"

Loading…
Cancel
Save