3 part video tutorial for beginners to Rust programming on iteration
These videos were originally recorded live on Twitch (https://twitch.tv/timclicks)
Introducing iteration
This video talks you through what an iterator is, why they’re useful and how to use them.
Some talking points:
- Syntax for iteration in Rust
- How working with collections would need to occur without iterators
- Difference between
iter()
,into_iter()
anditer_mut()
- Some of the higher-order programming techniques that Rust’s iterators enable (map/reduce style processing)
Implementing iterators in Rust & creating a random number generator!
Learn to implement the Iterator
trait in the Rust programming language. 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.
Who loves for loops? Implement the IntoIterator
trait
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.
1 note
- tim-mcnamara posted this