mirror of
https://github.com/rust-lang/rustlings.git
synced 2025-01-09 20:03:24 +03:00
Compare commits
No commits in common. "dc5c72bc19951313e80f038961fb446bd6ea02f5" and "b7289e59aae11b294706b219df614efc2d852b60" have entirely different histories.
dc5c72bc19
...
b7289e59aa
85
README.md
85
README.md
|
@ -21,12 +21,9 @@ Before installing Rustlings, you need to have _Rust installed_.
|
||||||
Visit [www.rust-lang.org/tools/install](https://www.rust-lang.org/tools/install) for further instructions on installing Rust.
|
Visit [www.rust-lang.org/tools/install](https://www.rust-lang.org/tools/install) for further instructions on installing Rust.
|
||||||
This'll also install _Cargo_, Rust's package/project manager.
|
This'll also install _Cargo_, Rust's package/project manager.
|
||||||
|
|
||||||
> 🐧 If you're on Linux, make sure you've installed `gcc` (for a linker).
|
🐧 If you're on Linux, make sure you've installed `gcc` (for a linker). Deb: `sudo apt install build-essential gcc`. Dnf: `sudo dnf install gcc`.
|
||||||
>
|
|
||||||
> Deb: `sudo apt install gcc`.
|
|
||||||
> Dnf: `sudo dnf install gcc`.
|
|
||||||
|
|
||||||
> 🍎 If you're on MacOS, make sure you've installed Xcode and its developer tools by running `xcode-select --install`.
|
🍎 If you're on MacOS, make sure you've installed Xcode and its developer tools by typing `xcode-select --install`.
|
||||||
|
|
||||||
### Installing Rustlings
|
### Installing Rustlings
|
||||||
|
|
||||||
|
@ -38,16 +35,15 @@ The following command will download and compile Rustlings:
|
||||||
cargo install rustlings@6.0.0-beta.3
|
cargo install rustlings@6.0.0-beta.3
|
||||||
```
|
```
|
||||||
|
|
||||||
<details>
|
#### Troubleshooting
|
||||||
<summary><strong>If the installation fails…</strong> (<em>click to expand</em>)</summary>
|
|
||||||
|
If the installation fails…
|
||||||
|
|
||||||
<!-- TODO: Remove @6.0.0-beta.x -->
|
<!-- TODO: Remove @6.0.0-beta.x -->
|
||||||
|
|
||||||
- Make sure you have the latest Rust version by running `rustup update`
|
- Make sure you have the latest Rust version by running `rustup update`.
|
||||||
- Try adding the `--locked` flag: `cargo install rustlings@6.0.0-beta.3 --locked`
|
- Try adding the `--locked` flag: `cargo install rustlings --locked`
|
||||||
- Otherwise, please [report the issue](https://github.com/rust-lang/rustlings/issues/new)
|
- Otherwise, please [report an issue](https://github.com/rust-lang/rustlings/issues/new).
|
||||||
|
|
||||||
</details>
|
|
||||||
|
|
||||||
### Initialization
|
### Initialization
|
||||||
|
|
||||||
|
@ -57,7 +53,7 @@ After installing Rustlings, run the following command to initialize the `rustlin
|
||||||
rustlings init
|
rustlings init
|
||||||
```
|
```
|
||||||
|
|
||||||
Now, go into the newly initialized directory and launch Rustlings for further instructions on getting started with the exercises:
|
Now, go into the newly initialized directory and run Rustlings for further instructions on getting started with the exercises:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cd rustlings/
|
cd rustlings/
|
||||||
|
@ -66,40 +62,45 @@ rustlings
|
||||||
|
|
||||||
## Doing exercises
|
## Doing exercises
|
||||||
|
|
||||||
The exercises are sorted by topic and can be found in the subdirectory `exercises/<topic>`.
|
The exercises are sorted by topic and can be found in the subdirectory `rustlings/exercises/<topic>`.
|
||||||
For every topic, there is an additional `README.md` file with some resources to get you started on the topic.
|
For every topic there is an additional README file with some resources to get you started on the topic.
|
||||||
We highly recommend that you have a look at them before you start 📚️
|
We really recommend that you have a look at them before you start.
|
||||||
|
|
||||||
|
The task is simple.
|
||||||
Most exercises contain an error that keeps them from compiling, and it's up to you to fix it!
|
Most exercises contain an error that keeps them from compiling, and it's up to you to fix it!
|
||||||
Some exercises contain tests that need to pass for the exercise to be done ✅
|
Some exercises are also run as tests, but Rustlings handles them all the same.
|
||||||
|
To run the exercises in the recommended order, execute:
|
||||||
|
|
||||||
### Watch Mode
|
```bash
|
||||||
|
rustlings
|
||||||
|
```
|
||||||
|
|
||||||
After [initialization](#initialization), Rustlings can be launched by simply running the command `rustlings`.
|
This will try to verify the completion of every exercise in a predetermined order (what we think is best for newcomers).
|
||||||
|
It will also rerun automatically every time you change a file in the `exercises/` directory.
|
||||||
|
|
||||||
This will start the _watch mode_ which walks you through the exercises in a predefined order (what we think is best for newcomers).
|
In case you want to go by your own order, or want to only verify a single exercise, you can run:
|
||||||
It will rerun the current exercise automatically every time you change the exercise's file in the `exercises/` directory.
|
|
||||||
|
|
||||||
<details>
|
```bash
|
||||||
<summary><strong>If detecting file changes in the <code>exercises/</code> directory fails…</strong> (<em>click to expand</em>)</summary>
|
rustlings run EXERCISE_NAME
|
||||||
|
```
|
||||||
|
|
||||||
> You can add the **`--manual-run`** flag (`rustlings --manual-run`) to manually rerun the current exercise by entering `r` or `run` in the watch mode.
|
Or simply use the following command to run the next pending exercise in the course:
|
||||||
>
|
|
||||||
> Please [report the issue](https://github.com/rust-lang/rustlings/issues/new) with some information about your operating system and whether you run Rustlings in a container or virtual machine (e.g. WSL).
|
|
||||||
|
|
||||||
</details>
|
```bash
|
||||||
|
rustlings run
|
||||||
|
```
|
||||||
|
|
||||||
### Exercise List
|
In case you get stuck, you can run the following command to get a hint for your exercise:
|
||||||
|
|
||||||
In the [watch mode](#watch-mode) (after launching `rustlings`), you can enter `l` or `list` to open the interactive exercise list.
|
```bash
|
||||||
|
rustlings hint EXERCISE_NAME
|
||||||
|
```
|
||||||
|
|
||||||
The list allows you to…
|
You can also get the hint for the next pending exercise with the following command:
|
||||||
|
|
||||||
- See the status of all exercises (done or pending)
|
```bash
|
||||||
- `c`: Continue at another exercise (temporarily skip some exercises or go back to a previous one)
|
rustlings hint
|
||||||
- `r`: Reset status and file of an exercise (you need to _reload/reopen_ its file in your editor afterwards)
|
```
|
||||||
|
|
||||||
See the footer of the list for all possible keys.
|
|
||||||
|
|
||||||
## Continuing On
|
## Continuing On
|
||||||
|
|
||||||
|
@ -110,15 +111,25 @@ Continue practicing your Rust skills by building your own projects, contributing
|
||||||
|
|
||||||
## Uninstalling Rustlings
|
## Uninstalling Rustlings
|
||||||
|
|
||||||
If you want to remove Rustlings from your system, run the following command:
|
If you want to remove Rustlings from your system, there are two steps.
|
||||||
|
|
||||||
|
1️⃣ Remove the `rustlings` directory that was created by `rustlings init`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
rm -r rustlings
|
||||||
|
```
|
||||||
|
|
||||||
|
2️⃣ Run `cargo uninstall` to remove the `rustlings` binary:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cargo uninstall rustlings
|
cargo uninstall rustlings
|
||||||
```
|
```
|
||||||
|
|
||||||
|
That's it!
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
See [CONTRIBUTING.md](https://github.com/rust-lang/rustlings/blob/main/CONTRIBUTING.md) 🔗
|
See [CONTRIBUTING.md](https://github.com/rust-lang/rustlings/blob/main/CONTRIBUTING.md).
|
||||||
|
|
||||||
## Contributors ✨
|
## Contributors ✨
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue