# Rust By Practice: an exercise book you build with mdBook

> Rust By Practice is a free exercise collection for learning Rust, built with mdBook and split into English and Chinese books. It is a good fit for self-directed learners who want graded problems and published solutions, and a poor fit for anyone expecting a maintained course with a stable API.

**origin-brain/rust-by-practice** — Rust By Practice will evolve into Origin.

- Repository: https://github.com/origin-brain/rust-by-practice
- Website: https://practice.course.rs
- Stars: 14,784 · Forks: 1,197
- Language: Rust
- License: CC-BY-4.0
- Published: 2026-09-21 · Updated: 2026-09-21 · Language: en
- Canonical page: https://hysenlabs.com/projects/origin-brain-rust-by-practice

## What Rust By Practice actually is, and who it is for

Rust By Practice is a book of Rust examples, exercises and practices, published online at practice.rs and hosted in a repository whose top level holds en/, zh-CN/, practices/, solutions/ and scripts/. The README describes the goal plainly: to fill the gap between learning the language and starting real projects. That places it after a first pass through syntax, not before it. The README states that the overall difficulty is a bit higher than comparable material and runs from easy to super hard, marked with one to four stars. A reader who has never written a match expression will find the starred exercises hostile rather than instructive. A reader who has finished a syntax tutorial and now needs repetition on ownership, destructuring and pattern guards is the intended audience. The README also notes that part of the examples and exercises are borrowed from Rust By Example, with credit given, so the two overlap in places. The distinguishing claim the README makes is that each chapter has examples, exercises and practices, and that every exercise has its own solution.

## How the book is assembled: mdBook, Markdown and a solutions directory

The mechanism is ordinary mdBook. Exercise text lives in Markdown under en/ and zh-CN/, with code blocks fenced as rust or rust,editable, and mdBook renders those blocks into pages. The README's own examples show the shape: a code block with a comment such as "fix the error and fill the blanks", blanks written as ___, and assertions the reader must satisfy. The repository layout backs this up. practices/ and solutions/ sit beside the two language directories, so the exercise text and its answers are separate trees rather than interleaved. scripts/ exists at the top level, which suggests repository maintenance is scripted, though the README does not describe what those scripts do. There is no runtime, no test harness described in the README, and no package to import. The loop is: read the page, edit the code until it compiles, then compare against the solution. The README claims exercises can be read, edited and run online, which matches the rust,editable fence used in the samples. That editable fence is what turns a static page into something a browser can execute, and it is the reason the book works without a local install at all.

## Running the book locally with mdbook serve

The README gives four steps, and they are the whole install story. Clone the repository, install mdBook through Cargo, then serve whichever language directory you want. The clone command as written in the README omits the .git suffix and the owner differs from the repository path shown elsewhere, so use the URL your Git client accepts.

```bash
git clone https://github.com/sunface/rust-by-practice
```

mdBook is installed as a Cargo binary, which means you need a working Rust toolchain first. The README does not pin a version.

```bash
cargo install mdbook
```

Then serve the English book from inside the cloned directory. mdBook builds the site and serves it on its default local port; the README does not name the port, and mdBook's own documentation is the place to check it.

```bash
cd rust-by-practice && mdbook serve en/
```

The Chinese book uses the same command with the other directory.

```bash
cd rust-by-practice && mdbook serve zh-CN/
```

What you should see is a local copy of the book with the same chapters as practice.rs, including the editable code blocks. If the build fails, the failure is almost always mdBook or the toolchain rather than the exercise content, because the content is plain Markdown. A first real use is to open the ownership or pattern matching chapter, pick a two-star exercise, and work it in the browser editor before touching a local file.

## The exercise design, and where it breaks down

The samples in the README show a consistent teaching device: give working code with a deliberate defect, mark the defect with a comment, and constrain the fix. One exercise on tuple structs asks the reader to fill three blanks in a Point construction and then satisfy assertions on a Color value, including a check that p.1 equals 127. Another on partial moves requires the reader to modify exactly one line, the println! that tries to use a moved field, with the instruction "ONLY modify this line". A third on match guards requires the split binding to be used, which rules out the lazy rewrite of the pattern. This is a stricter form of exercise than filling in a function body, and it is the strongest part of the project.

The limitation is that nothing in the repository pins the compiler these exercises were written against. Rust changes; diagnostics change more often than semantics. An exercise that says "fix the error" assumes a specific error, and when the compiler's message shifts, the instruction can read as misleading even though the code is still wrong. The README does not document a supported Rust version, a test command that validates the exercises, or a policy for updating them. The last push to the repository was on 2026-08-24, so work is ongoing, but the README gives no release history and no changelog, which means a reader has no way to tell whether a given chapter was touched recently or years ago. Treat the exercises as prompts, not as a specification.

## Rustlings and Rust By Example: different jobs

Rustlings is the obvious alternative, and the difference is in the delivery. Rustlings is a set of exercises you install and run locally, with a watcher that checks your work as you go, so the feedback loop is a terminal. Rust By Practice is a book you read and edit, with solutions published in a separate directory and an online editor for the browser. If you want a tool that tells you when an exercise passes, Rustlings is the closer match. If you want prose around the exercise, graded difficulty, and the option to read on a phone, Rust By Practice is the closer match.

Rust By Example is the other reference point, and the relationship is acknowledged: the README says part of the examples and exercises are borrowed from it. Rust By Example is a tour of language features with runnable snippets. Rust By Practice takes that material and adds the exercise layer on top, which is why the two feel similar at the start of a chapter and diverge once the blanks appear. Choosing between them is mostly a question of whether you learn by reading or by repairing broken code.

## Licence, maintenance and the cost of keeping up

The repository is licensed CC-BY-4.0, a content licence rather than a software licence. That is consistent with what the project is: Markdown text, not code you link against. If you want to reuse exercises in your own material, the licence permits it with attribution, and the README already models that practice by crediting Rust By Example. This is not legal advice; read the licence text before republishing.

The upgrade cost is low in the sense that there is nothing to upgrade. There is no published release, no version number in the README, and no dependency to bump. Your cost is the toolchain: cargo install mdbook pulls whatever mdBook version is current, and if a future mdBook changes how it handles the rust,editable fence, the online behaviour of exercises is what would change first. The README does not document a rollback path or a pinned mdBook version, so if a build breaks after an mdBook update, the fix is to install an older mdBook yourself. The last push was on 2026-08-24, which is recent enough that the content is not abandoned, but the absence of releases means you cannot point at a stable edition.

## Conclusion

Adopt Rust By Practice if you already read Rust syntax and want graded problems with published solutions, and if you are willing to run mdbook serve en/ locally or use the online book. Do not adopt it if you need a versioned dependency, a syllabus with support, or a package you install into a project: this is a book repository whose README documents no releases. Before you start, verify three things: that the exercise you want still matches your compiler, that a solution exists in solutions/ for the chapter you are on, and that the licence, CC-BY-4.0, fits how you intend to reuse the text.

## FAQ

### Is learning Rust worth it in 2026?

The README does not address the job market or the value of learning Rust. It only states that the book is designed to help readers get skilled with Rust by making each exercise compile without errors and panics.

### Is Rust basically C++?

The README makes no comparison between Rust and C++. It describes the book's own structure: examples, exercises and practices in each chapter, with solutions for every exercise.

### Is Rust really hard to learn?

The README does not rate Rust's overall difficulty, but it says the exercises here are a bit harder than comparable material and range from easy to super hard, marked with one to four stars.

### How can a beginner learn Rust?

The README positions this book as filling the gap between learning and starting real projects, and says all you need to do is make each exercise compile without errors and panics. Part of the examples and exercises are borrowed from Rust By Example.

## Sources

- [Issues](https://github.com/origin-brain/rust-by-practice/issues)
- [License: CC-BY-4.0](https://github.com/origin-brain/rust-by-practice/blob/master/LICENSE)
- [origin-brain/rust-by-practice on GitHub](https://github.com/origin-brain/rust-by-practice)
- [Project website](https://practice.course.rs)
- [README](https://github.com/origin-brain/rust-by-practice/blob/master/README.md)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/origin-brain-rust-by-practice
