Rust theorytheory 0/50 · 0%
Collections · medium

27. Iterator Trait in Depth

Implementing and composing iterators.

Implementing `Iterator` means writing `next()`; every adapter comes free. Adapters compile down to tight loops, so pipelines usually match hand-written code. fold, scan, zip, chain, peekable and flat_map cover most transformations.

Check your understanding

  1. 1. Implementing Iterator requires which method?

  2. 2. Adapter pipelines typically cost…