explaingit

sunface/rust-by-practice

14,213RustAudience · developerComplexity · 1/5LicenseSetup · easy

TLDR

A free, interactive book of Rust exercises where you fix broken or incomplete code snippets covering everything from basic types to async programming, available in the browser at practice.rs or locally via mdBook.

Mindmap

mindmap
  root((rust-by-practice))
    What it does
      Fix broken Rust code
      Learn by doing
      Graded difficulty
    Topics covered
      Ownership and borrowing
      Async programming
      Threads and data structures
    How to use
      Online at practice.rs
      Local mdBook server
    Audience
      New Rust learners
      Developers from other languages
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Work through graded exercises to learn Rust by filling in blanks or fixing broken code until it compiles

USE CASE 2

Practice Rust async, threads, and data structures without installing anything using the online editor at practice.rs

USE CASE 3

Host the book locally with mdBook to follow along offline at your own pace

USE CASE 4

Use the provided solutions to get unstuck and understand why your approach did not compile

Tech stack

RustmdBook

Getting it running

Difficulty · easy Time to first run · 5min
Share and adapt freely for any purpose as long as you credit the original author (Creative Commons Attribution 4.0).

In plain English

Rust by Practice is a free, open learning resource for the Rust programming language. It is structured as a book of exercises: each chapter covers a specific part of the language, and your job is to make broken or incomplete code snippets compile and run correctly without errors. Each chapter has three sections: worked examples that show how something works, exercises where you fill in blanks or fix mistakes, and small practice projects that put multiple concepts together. Every exercise has a provided solution, so you can check your work or get unstuck. The exercises cover a wide range of topics, from basic types and ownership to more advanced areas like async programming, threads, synchronization, data structures, and standard library utilities. Difficulty is labeled explicitly, ranging from easy to "super hard." The exercises are available online at practice.rs, where you can read, edit, and run code directly in the browser without installing anything. If you prefer to work locally, the book is built with a tool called mdBook, which you can install and serve on your own machine. Both English and Chinese versions exist. The stated goal is to close the gap between reading about Rust and being able to write real code in it. The exercises are intentionally more challenging than typical introductory material, on the theory that working through harder problems builds confidence and skill faster. The book is licensed under Creative Commons Attribution 4.0, which means you can share and adapt it freely with credit.

Copy-paste prompts

Prompt 1
I'm stuck on a rust-by-practice ownership exercise. Here is the broken code: [paste snippet]. Explain why it fails and show me the minimal fix.
Prompt 2
Generate 3 rust-by-practice-style exercises on Rust lifetimes where I fill in the missing lifetime annotations to make the code compile.
Prompt 3
I want to run the rust-by-practice book locally with mdBook on macOS. Walk me through installing mdBook and serving the book on localhost.
Prompt 4
Using rust-by-practice as a syllabus, create a one-week study plan for learning Rust ownership, borrowing, and basic concurrency.
Open on GitHub → Explain another repo

← sunface on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.