Crust of Rust: Iterators

Crust of Rust: Iterators

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. Crust of Rust: Iterators

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/dd63b7... .

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

☞ Crust of Rust: Lifetime Annotations ☞ Crust of Rust: Declarative Macros ☞ Crust of Rust: Iterators ☞ Crust of Rust: Smart Pointers and Interior Mutability ☞ Crust of Rust: Channels

rust programming

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

RUST on programming language

In this blog, I am going to run around and see the different aspects of programming language rust. And talk about the concepts that it introduces that are useful for various aspects of programming.

The Rust Programming Language - Understanding Loops in Rust

In this Rust programming language tutorial, we'll understanding Loops in Rust. Rust currently provides three approaches to performing some kind of iterative activity. They are: loop, while and for. The infinite loop is the simplest form of loop available in Rust. Rust also has a while loop. The for loop is used to loop a particular number of times

OS in Rust: An executable that runs on bare metal

This is the very first blog of the series that pertains to create a basic Operating System using Rust Programming Language. The aim of this series is to learn and understand the basics of Operating System. Through this series, you will get some ideas about the internal components of Operating System and how they interact with each other.

This Rust programming language

An introduction to the Tuples data type. This Rust programming language tutorial series is aimed at easing your training step by step. Rust is a systems leve...

Rust Casting, Shadowing, Consts and Static

A mix of topics of casting, shadowing, constants and static variables inside the Rust Programming Language. This Rust programming language tutorial series is aimed at easing your training step by step.