Iterators in Rust
Rust has features inspired by functional programming. Iterators – a way to process some sequence of elements – are such a feature. If you are working in a language that lacks them, you would be responsible for handling the logic to track where you are in the sequence and when you should stop, which can get confusing and lead to bugs. Iterators conceal the details so it is easier to reason about the high-level objectives of your code. You don’t pay a performance cost either. Iterators compile to about the same amount of code as standard loops. Prefer the iterator style to write clear, concise, idomatic Rust:
Functional Language Features: Iterators and Closures - The Rust Programming Language