typestar

Iterators & closures

14 steps in 5 sets of Rust.

Rust's iterators are lazy, zero-cost, and the idiomatic way to do almost anything to a collection. The adapters first, then closures and fold, then the terminal operations that actually make something happen.

The last set is maps and counting, which is where iterator chains stop being an exercise and start replacing loops you would otherwise have written by hand.

Start this tour

Adapters

Closures & folding

Terminal operations

Maps & counting

Encore

  • wordcount.rsA complete word-frequency program: read stdin, tally, sort, print.

The other Rust tours