|
3 | 3 | Greetings and welcome to rustlings. This project contains small exercises to get you used to reading and writing code. This includes reading and responding to compiler messages!
|
4 | 4 |
|
5 | 5 | ## How to get started
|
6 |
| -To use rustlings you have to have [rust](https://www.rust-lang.org/) installed on your machine. |
7 |
| -If you already have it, you can clone the repo to your local environment with: |
8 |
| -``` bash |
| 6 | + |
| 7 | +To use rustlings you need to have a [Rust](https://www.rust-lang.org/) toolchain installed. To install it go to [rustup.rs](https://rustup.rs/). |
| 8 | + |
| 9 | +Once Rust is installed, clone the rustlings repository and enter the resulting directory: |
| 10 | + |
| 11 | +```bash |
9 | 12 | git clone https://github.com/rustlings/rustlings.git
|
| 13 | +cd rustlings |
| 14 | +``` |
| 15 | + |
| 16 | +Once in the directory you can install rustlings on your machine and run exercises: |
| 17 | + |
| 18 | +```bash |
| 19 | +cargo install --path . |
| 20 | +rustlings <command> |
10 | 21 | ```
|
11 |
| -To run rustlings you can either use `cargo run <subcommand>` or you can install rustlings on your machine |
12 |
| -by running `cargo install --path <path to the rustlings repo>` |
13 |
| -(NOTE: for rustling to function you have to be in the directory of the repo). |
| 22 | + |
| 23 | +Or run rustlings directly with cargo, without installing it: |
| 24 | + |
| 25 | +```bash |
| 26 | +cargo run <command> |
| 27 | +``` |
| 28 | + |
| 29 | +If you choose to not install rustlings, just replace `rustlings` with `cargo run` in the rest of this text. |
14 | 30 |
|
15 | 31 | ## Doing exercises
|
| 32 | + |
16 | 33 | 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.
|
17 | 34 |
|
18 |
| -Your task is simple every exercise contains an error you have to solve, in order to make it compile. |
| 35 | +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. |
| 36 | + |
| 37 | +Your task is simple. Every exercise contains an error you have to solve, in order to make it compile. |
| 38 | + |
| 39 | +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. |
| 40 | + |
| 41 | +`rustlings watch` will rerun this verification every time you save an exercise. |
| 42 | + |
| 43 | +To compile and run a single exercise you can use `rustlings run <path to the exercise>`. |
19 | 44 |
|
20 |
| -Running rustlings with the subcommand `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. |
| 45 | +In case you get stuck, there is usually a hint at the bottom of each exercise. |
21 | 46 |
|
22 |
| -If you want to run a single exercise, you can use the subcommand `run <path to the exercise>`. |
| 47 | +### Need help? |
23 | 48 |
|
24 |
| -When you struggle to solve the error, there is usually a tip at the bottom of each exercise. |
| 49 | +If you need more help or would like to compare solutions, you can ask in [#rust-beginners on |
| 50 | +irc.mozilla.org](https://chat.mibbit.com/?server=irc.mozilla.org&channel=%23rust-beginners ), the |
| 51 | +[user forum](https://users.rust-lang.org/), or [the subreddit](https://reddit.com/r/rust). If an |
| 52 | +exercise could be improved in any way, please [create an |
| 53 | +issue](https://github.com/carols10cents/rustlings/issues/new) or submit a pull request! |
0 commit comments