Introduction
About This Book
"Wonderfull Rust" is a sequel to "Bitterless Rust."
In Bitterless Rust, we intentionally omitted the "bitter" parts of Rust, using oversimplified explanations with the sole goal of "getting code that runs." Ownership, lifetimes, traits, macros, unsafe -- all were set aside as "things to learn later."
This book faces that "later" head-on.
However, we won't systematically cover everything like The Book does. The goal of this book is to conceptually and accurately understand what makes Rust wonderful. We'll dig into why Rust is designed the way it is, and what exactly makes those design choices excellent.
What This Book Covers
- Expression-Based Programming -- Expression-oriented design and the Unit type, inherited from ML-family languages
- The Type System -- Hindley-Milner type inference, generics, GATs
- Abstraction Through Unit and Trait Impl -- A deep dive into the Unit type, generalizing built-in features, and extending them to user-defined types
- The Borrow Checker -- Ownership, lifetimes, and concurrency safety guarantees
- The Module System -- Visibility control and the rationality of use syntax
- Macros -- Metaprogramming with declarative and procedural macros
- Performance -- Execution performance through zero-cost abstractions and the LLVM backend
- Memory-Level Programming -- unsafe, bare metal, and the low-level world
- All-in-One Tooling -- The unity of the ecosystem centered on Cargo
- Cross-Building -- The world of cross-compilation, including WebAssembly and napi-rs
- Documentation -- The integration of rustdoc and doc tests
Prerequisites
We assume you've completed Bitterless Rust or have equivalent foundational knowledge of Rust. Specifically, you should understand:
- Basic usage of
let,fn,struct,enum,impl - Pattern matching with
match - Basic usage of
Vec,String,Option,Result - Basic operations with
cargo run,cargo build
Also, since this book explains "what's excellent about Rust's design philosophy," having experience with other programming languages (C, C++, Java, TypeScript, Python, etc.) will help you understand things more deeply.
On Notation
Unlike Bitterless Rust, this book strives for accurate, unambiguous explanations. We prioritize conceptual accuracy, touching on theoretical background where necessary. That said, there are places where we favor "conceptual accuracy" over academic rigor.
With that, let's explore Rust's wonderful qualities, one by one.