Skip to content


Folders and files

Last commit message
Last commit date

Latest commit


Repository files navigation

Code practice for the Rust book

This is a repository of the code practice bits in The Rust Programming Language, by Steve Klabnik and Carol Nichols, with contributions from the Rust Community. Each directory corresponds to a chapter or subchapter of the book, matching its URL when possible. Some examples spanning across several subchapters are merged into one directory, i.e. the extensive restaurant example of chapter 7.

Everything should compile without warning and binaries should run:

  • Warnings about unused code are disabled when it makes sense.
  • Code samples that are not functional are commented out.

For code samples from the core text, functions and structs declarations are often inlined straight in the main() function body to follow the book reading flow. This might feel a little awkward, but the idea is to prevent mixing up concepts to much. Coding exercises are written using a more traditional fashion.

I intend to use this as future reference, but if that's useful for you then help yourself. The coding exercises "solutions" might help, but I offer no warranty whatsoever that they are the best ones 😉. Feel free to make pull requests if you find errors, or have better solutions to suggest, and I'll be more than happy to have a look at them.


Code practice for the Rust book








No releases published


No packages published