Skip to content

Rust Exercises for learning to use std::iter::Iterator

License

Notifications You must be signed in to change notification settings

kklibo/rustex-iterators

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rustex-iterators

Rust Exercises for learning to use std::iter::Iterator

Who is this for?

If you already know the basics of Rust and would like to learn more about Rust iterators, these exercises are for you.

If you're just getting started with Rust, you should definitely do the Rustlings exercises (https://github.com/rust-lang/rustlings) first, and then come back and do these ones.

What are these exercises?

Each exercise starts with a function that already succeeds at accomplishing some task. Your goal is to use std::iter::Iterator methods to write a more concise function that exactly matches the original function's behavior.

Why do them?

When you're done, you will have tried roughly half of Iterator's methods (it's a long list!), and you will have a sense of how concise and elegant Rust iterators can be.

How to do these exercises

Start by reading

These exercises are test-driven: an exercise is complete when its tests pass. Run cargo test to see the next error to be fixed, or to confirm your solution.

To advance to the next level, uncomment the next module in lib.rs.

Alternative without local Rust

If you don't have Rust installed locally, you can also manually copy the exercise file contents in the src directory to the Rust Playground and run them there.

Answers

ANSWERS.md contains example answers for each exercise.

Good luck! Run cargo test to start.

About

Rust Exercises for learning to use std::iter::Iterator

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages