I’m starting with Rust, and with a little background in Ruby I heavily enjoy similarities between the languages. One thing, though, is my lack of understanding why there is no .each() iterator method to call up a closure on an iterator that doesn’t have a return value, avoiding the “iterator adapters are lazy and do nothing unless consumed”. I did read the respective paragraph from the book, but I don’t see why the language shouldn’t be able to support a way to declare an iterator such that it fires even without the result being used. The lazy thing about iterators, btw, is a cool thing - could mate quite nicely with automated multi-threaded pipeline processing.
It is so awkward that I can chain iterators, but the final iteration has to be done with a BASIC/Python-style for loop. In Ruby I completely forgot about for because it’s so much more intuitive to iterate over the iterator just like in map and filter calls.
I’m just starting with Rust, so I might have not seen yet the discussion about this topic yet.
Thanks for any pointers and reasoning,