File:Crust of Rust- Iterators.webm

Summary

Description
English: In this third Crust of Rust video, we cover iterators and trait bounds, by re-implementing the "flatten" Iterator method from the standard library. As part of that, we cover some of the weirder trait bounds that are required, including what's needed to extend the implementation to support backwards iteration.

You can find the final code at https://gist.github.com/jonhoo/dd63b720fa4a220ea845a77e2d75831e.

0:00:00 Introduction 0:01:45 The Iterator trait 0:04:25 The IntoIterator trait 0:06:24 Generic traits vs associated types 0:13:37 Provided Iterator methods 0:14:42 Iterator::flatten 0:20:07 Associated items of generics in bounds 0:23:10 Why must O as Trait be bracketed? 0:24:28 Flattening more than two levels 0:25:24 First attempt at Flatten::next 0:29:59 Two elements in inner iterator 0:31:05 Two elements in outer iterator 0:33:29 Simplifying with ? 0:35:05 Storing the inner iterator 0:39:10 Trait bound syntax 0:40:07 Finishing corrected next 0:42:50 Ergonomics with IntoIterator 0:44:15 DoubleEndedIterator 0:46:10 First draft of DEI implementation 0:50:57 Testing double-ended iteration 0:53:58 Iterating from both ends in parallel 1:04:02 The cost of two cursors 1:06:28 Iterators are like Futures 1:07:14 Calling next and next_back concurrently 1:07:55 ref in patterns 1:09:33 Why not flatten first, then iterate 1:12:51 More ref in patterns 1:14:09 Deeper flattening 1:17:00 FlatMap 1:18:19 Ergonomics through extension traits 1:21:19 Sized in traits

You can watch the live version with comments at https://www.youtube.com/watch?v=pqHWEsXamYg
Date
Source YouTube: Crust of Rust: Iterators – View/save archived versions on archive.org and archive.todayCategory:Media from YouTube
Author Jon Gjengset

Licensing

This video, screenshot or audio excerpt was originally uploaded on YouTube under a CC BY license.
Their website states: "YouTube allows users to mark their videos with a Creative Commons CC BY license."
To the uploader: You must provide a link (URL) to the original file and the authorship information if available.
w:en:Creative Commons
attribution
This file is licensed under the Creative Commons Attribution 3.0 Unported license.
Attribution:
Jon Gjengset
You are free:
  • to share – to copy, distribute and transmit the work
  • to remix – to adapt the work
Under the following conditions:
  • attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
Category:CC-BY-3.0#Crust%20of%20Rust-%20Iterators.webm
Category:Media from YouTube#Crust%20of%20Rust-%20Iterators.webm
This file, which was originally posted to an external website, has not yet been reviewed by an administrator or reviewer to confirm that the above license is valid. See Category:License review needed for further instructions.
Category:License review needed (video)#153341846 Category:Uploaded with video2commons Category:Videos of Rust (programming language)
Category:CC-BY-3.0 Category:License review needed (video) Category:Media from YouTube Category:Uploaded with video2commons Category:Videos of Rust (programming language)