1
0
mirror of https://github.com/rust-lang/rustlings.git synced 2024-12-10 11:10:26 +02:00
🦀 Small exercises to get you used to reading and writing Rust code!
Go to file
Erik Vesteraas 7f5ab6e1dc Continue work on new readme.
- Be more explicit re terminal commands
- Copy over "Need help?" section
- General wording
2018-11-26 15:07:34 +01:00
exercises right let's try this one again 2018-11-09 20:31:14 +01:00
src Add watch mode, and don't panic on clean failure 2018-11-26 12:45:29 +01:00
.gitignore remove and ignore .DS_Store 2018-11-14 19:24:11 +01:00
Cargo.toml Add watch mode, and don't panic on clean failure 2018-11-26 12:45:29 +01:00
default_out.md add markdown output for default command 2018-11-26 11:10:38 +01:00
ex6.rs Add exercise for creating references in patterns 2018-10-31 04:01:42 +01:00
LICENSE Update LICENSE year. 2016-03-27 15:57:49 -04:00
README.md Continue work on new readme. 2018-11-26 15:07:34 +01:00

rustlings

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

How to get started

To use rustlings you need to have a Rust toolchain installed. To install it 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 exercises:

cargo install --path .
rustlings <command>

Or run rustlings directly with cargo, without installing it:

cargo run <command>

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

Doing exercises

The execises 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!