Skip to content

🦀 Small exercises to get you used to reading and writing Rust code!

License

Notifications You must be signed in to change notification settings

andremoeller/rustlings

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

crab pet

rustlings 🦀❤️

Greetings and welcome to rustlings. This project contains small exercises to get you used to reading and writing Rust code. This includes reading and responding to compiler messages!

Alternatively, for a first-time Rust learner, there's several other resources:

  • The Book - The most comprehensive resource for learning Rust, but a bit theoretical sometimes
  • Rust By Example - Learn Rust by solving little exercises! It's almost like rustlings, but online

Getting Started

To use rustlings you need to have Rust installed on your computer. To install Rust, go to rustup.rs.

Once Rust is installed, clone the rustlings repository and enter the resulting directory:

git clone https://github.com/rustlings/rustlings.git
cd rustlings

Once in the directory you can install rustlings on your machine and run the introduction:

cargo install --path .
rustlings

If you choose to not install the rustlings command, just replace rustlings with cargo run in the rest of this text.

Doing exercises

The exercises are sorted by topic and can be found in the subdirectory rustlings/exercises/<topic>. For every topic there is an additional README file with some resources to get you started on the topic. We really recommend that you have a look at them before you start.

Your task is simple. Every exercise contains an error you have to solve in order to make it compile. Running rustlings verify will compile every exercise in the recommended order. It will stop at the first exercise that didn't compile and show you the error to be solved.

rustlings watch will rerun this verification every time you save an exercise.

To compile and run a single exercise you can use rustlings run <path to the exercise>.

In case you get stuck, there is usually a hint at the bottom of each exercise.

Need help?

If you need more help or would like to compare solutions, you can ask in #rust-beginners on irc.mozilla.org, the user forum, or the subreddit. If an exercise could be improved in any way, please create an issue or submit a pull request!

About

🦀 Small exercises to get you used to reading and writing Rust code!

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Rust 94.5%
  • Shell 3.3%
  • PowerShell 2.2%