typeover
rust curriculum

Curriculum Collections & iteration Iterators exercise 5 · fill-word

Iterators

Fill the part of the chain that tells .sum() what numeric type to produce. Rust calls this syntax the "turbofish."

TypeScript reference
Fill the blanks →

About this theme

Idiomatic Rust often transforms data with iterators instead of manual indexing. The key ownership distinction is .iter(), .iter_mut(), and .into_iter(). Planned exercises: 1. choose .iter() for reading. 2. recognise .into_iter() moves. 3. choose .map(...).collect(). 4. fill .filter. 5. fill .sum::<i32>(). 6. write a map-collect. 7. write an iterator chain that borrows. 8. translate TS map and filter. 9. fix a chain that consumes a vector too early.