Yet Another Rust Iterators Tutorial

Hi all,

Just to let you know I wrote a Rust iterators tutorial in dev.to: https://dev.to/dandyvica/yarit-yet-another-rust-iterators-tutorial-46dk

Hope it’ll help newcomers.

Comments welcome !

4 Likes

I like it!

Consider, in the implementation section, mentioning a few of the optional methods that may also be useful to override, like nth and fold (see https://github.com/rust-lang/rust/issues/60223).

A few code review nitpicks:

  • Consider deriving Debug on the iterator struct
  • Consider what Fibonacci should do on overflow, perhaps let next_fib = self.fib_n.checked_add(self.fib_n_1)?;

@scottmcm

Thanks for taking time of reading !

I was focusing on giving examples of iterators and for sure, code could be more comprehensive :wink:

Thanks for making this! I will add it to my to-do list for learning Rust.