https://github.com/hijiangtao/learn-rust-with-rustlings
🎉 Rustlings Solutions (Rustlings 解题集)
https://github.com/hijiangtao/learn-rust-with-rustlings
rust rust-lang rust-library rustlings rustlings-solution solutions
Last synced: 19 days ago
JSON representation
🎉 Rustlings Solutions (Rustlings 解题集)
- Host: GitHub
- URL: https://github.com/hijiangtao/learn-rust-with-rustlings
- Owner: hijiangtao
- License: mit
- Created: 2019-05-28T13:38:16.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2022-04-12T15:37:35.000Z (about 3 years ago)
- Last Synced: 2025-04-08T12:21:09.394Z (about 2 months ago)
- Topics: rust, rust-lang, rust-library, rustlings, rustlings-solution, solutions
- Language: Rust
- Homepage: https://github.com/hijiangtao
- Size: 43.9 KB
- Stars: 8
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# learn-rust-with-rustlings
## README (EN)
Small exercises to get you used to reading and writing Rust code. Includes practice reading and responding to compiler messages!
This repo is my rustlings' solution collection. Hope it can help you more or less. :)
**🎉 Successfully compiled all rustlings exercises! All the answers can be found in corresponding folders.** For example, you can check file `exercises/strings/strings1.rs` to read my solution about `strings` chapter.
* ✅ if
* ✅ functions
* ✅ variables
* ✅ primitive_types
* ✅ strings
* ✅ modules
* ✅ macros
* ✅ move_semantics
* ✅ error_handling
* ✅ threads
* ✅ standard_library_types## README (CN)
**🎉 Rust 学习之 Rustlings 训练答案集,所有训练均已完成。**
内容在具体的文件中可以查看,比如 `strings` 为已完成状态,则对应 `exercises/strings/strings1.rs` 文件中代码即为答案,以下为训练分章节目录。
* ✅ if
* ✅ functions
* ✅ variables
* ✅ primitive_types
* ✅ strings
* ✅ modules
* ✅ macros
* ✅ move_semantics
* ✅ error_handling
* ✅ threads
* ✅ standard_library_types## Manually Installation
Basically: Clone the repository, checkout to the latest tag, run `cargo install`.
```bash
git clone https://github.com/hijiangtao/learn-rust-with-rustlings
cd learn-rust-with-rustlings
cargo install --force --path .
```If there are installation errors, ensure that your toolchain is up to date. For the latest, run:
```bash
rustup update
```Then, same as above, run `rustlings` to get started.
## Doing exercises
The exercises are sorted by topic and can be found in the subdirectory `rustlings/exercises/`. 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.
The task is simple. Most exercises contain an error that keep it from compiling, and it's up to you to fix it! Some exercises are also run as tests, but rustlings handles them all the same. To run the exercises in the recommended order, execute:
```bash
rustlings watch
```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. If you want to only run it once, you can use:
```bash
rustlings verify
```This will do the same as watch, but it'll quit after running.
In case you want to go by your own order, or want to only verify a single exercise, you can run:
```bash
rustlings run exercises/path/to/exercise.rs
```In case you get stuck, there is usually a hint at the bottom of each exercise.
## Testing yourself
After every couple of sections, there will be a test that'll test your knowledge on a bunch of sections at once. These tests are found in `exercises/testN.rs`.
## Contact
[@hijiangtao](https://github.com/hijiangtao)
## LICENSE
MIT