C++ to Rust Phrasebook
This book is designed to help C++ programmers learn Rust. It provides translations of common C++ patterns into idiomatic Rust. Each pattern is described through concrete code examples along with high-level discussion of engineering trade-offs.
The book can be read front-to-back, but it is designed to be used random-access. When you are writing Rust code and think, "I know how to do this in C++ but not Rust," then look for the corresponding chapter in this book.
This book was hand-written by expert C++ and Rust programmers at Brown University's Cognitive Engineering Lab. Our goal is provide accurate information with a tasteful degree of detail. No text in this book was written by AI.
If you would like updates on when we add new chapters to this book, you can drop your email here.
Other resources
If you have zero Rust experience, you might consider first reading The Rust Programming Language or getting a quick overview at Learn X in Y Minutes.
If you are primarily an embedded systems programmer using C or C++, this book is a complement to The Embedded Rust Book.
Compared to resources like the Rustonomicon and Learn Rust With Entirely Too Many Linked Lists, this book is less about "Rust behind the scenes" and more about explicitly describing how Rust works in terms of C++.
Feedback on this book
At the bottom of every page there is a link to a form where you can submit feedback: typos, factual errors, or any other issues you spot.
If you answer the quizzes at the end of each chapter, we will save your responses anonymously for research purposes.
Click here to leave us feedback about this page.