rust-lang / rustlings

:crab: Small exercises to get you used to reading and writing Rust code!
https://rustlings.cool
MIT License
54.01k stars 10.15k forks source link

Add alternative solution for iterators5 #2019

Closed Nahor closed 4 months ago

Nahor commented 4 months ago

On one hand, nested iterators are somewhat common (container of containers, iterator of containers, container of iterators), so introducing flatten could be useful.

On the other hand, flatten, flat_map, etc. are not mentioned in the Rust book...

mo8it commented 4 months ago

Could you please use flat_map to only iterate over the values by mapping with .values()?