The Rust Book (Abridged)
v0.3.0 - Draft
By Jason Walton
Based on "The Rust Programming Language" by Steve Klabnik and Carol Nichols.
PDF version of this book is available here.
What is this?
This is an abridged - or perhaps a better word would be condensed - version of "The Rust Programming Language" (AKA "the Rust Book"). This is not an original work - all the chapter names and examples in this book have been copied verbatim from the original, but all of the prose has been rewritten from scratch, leaving out anything that's not about learning Rust. This book is about 1/2 the length of the original, but I don't think it is missing anything that an experienced software developer wouldn't already know.
The Rust Book is a great resource for learning Rust, especially if you're new to programming. If you fall into this category, then I strongly suggest you put this book down and go read it instead. But... the Rust Book is quite wordy. If you're already familiar with one or more other programming languages, then you are likely already familiar with a lot of the concepts the book covers, and you might benefit from this shorter version. If you are already familiar with ideas like the stack and the heap, with test driven development, with the DRY principle, then this might be a better read.
This isn't meant to be a criticism of the Rust Book. It's excellent and well written, and there's a reason why it's highly recommended. The problem here is not with the original book, but more a mismatch when it comes to intended audience.
What's different about this book?
As mentioned above, the chapter names in this book are all the same as in the original, and in many cases the subsections in each chapter are the same. In most cases examples have been copied directly from the original. Keeping the original structure and examples hopefully makes it easy to jump back and forth between this book and the original, in case there are places where this book is unclear or covers concepts you are not familiar with.
Where the original would build up a code example piece by piece, in most cases this version presents the finished code so you can read through it, and then points out some interesting parts. Where possible I've tried to add in material I think an advanced reader would find interesting. In some places this explains things in a different way than the original. This also adds an extra bonus chapter about async programming!
I have a great deal of experience in TypeScript, Java, C/C++, Go, and a few other languages. I spent about two weeks putting this book together, reading the original, condensing it, and researching parts that weren't clear. Hopefully someone finds this useful! But I am new to Rust so if you find something that doesn't make sense, please feel free to raise an issue.
This book was written entirely by a human - none of this is generated by ChatGPT.
If you enjoy this book, please give it a star on GitHub.
Table of Contents
- Chapter 1: Getting Started
- Chapter 2: Guessing Game
- Chapter 3: Common Programming Concepts
- Chapter 4: Ownership, References, and Slices
- Chapter 5: Using Structs to Structure Related Data
- Chapter 6: Enums and Pattern Matching
- Chapter 7: Managing Growing Projects with Packages, Crates, and Modules
- Chapter 8: Common Collections
- Chapter 9: Error Handling
- Chapter 10: Generic Types, Traits, and Lifetimes
- Chapter 11: Writing Automated Tests
- Chapter 12: An I/O Project: Building a Command Line Program
- Chapter 13: Functional Language Features: Iterators and Closures
- Chapter 14: More About Cargo and Crates.io
- Chapter 15: Smart Pointers
- Chapter 16: Fearless Concurrency
- Chapter 17: Object Oriented Features of Rust
- Chapter 18: Patterns and Matching
- Chapter 19: Advanced Features
- Chapter 20: Multithreaded Web Server
- Chapter 21: Bonus Chapter: Async Programming
(This version of this book is based on commit c06006).