Hi all,
I've spent some time this week recording a few tutorials on iteration. It's surprising how easy it is to mix up iter()
, iter_mut()
and into_iter()
!
The first video talks you through what an iterator is, why they’re useful and how to use them.
The video shows implementing an infinite iterator that cycles through the seasons—as well as discussing why maintaining state is required—then progress to an “XOR Shift RNG” as published by George Marsaglia.
Learn how to enable iterating through your type with the “for loop” syntax. We also spend some time taking a good look through the standard library to find example code for other traits that we might like to implement.
If you would like to share these, you're welcome to share the link to this forum post or a link to my blog where I've collected them all: