Improved iterators5.rs explanation.

This commit is contained in:
apogeeoak
2021-04-20 18:52:10 -04:00
parent b29ea17ea9
commit 9c88ea9126
2 changed files with 37 additions and 25 deletions

View File

@@ -694,7 +694,7 @@ 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
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.
"""
@@ -749,12 +749,13 @@ hint = """
The documentation for the std::iter::Iterator trait contains numerous methods
that would be helpful here.
Return 0 from count_stack to make the code compile in order to test count.
Return 0 from count_collection_iterator to make the code compile in order to
test count_iterator.
The stack variable in count_stack is a slice of HashMaps. It needs to be
converted into an iterator in order to use the iterator methods.
The collection variable in count_collection_iterator is a slice of HashMaps. It
needs to be converted into an iterator in order to use the iterator methods.
The fold method can be useful in the count_stack function."""
The fold method can be useful in the count_collection_iterator function."""
# THREADS