|
|
|
@ -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)]
|
|
|
|
|