Wonderfull Rust

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

  1. Expression-Based Programming -- Expression-oriented design and the Unit type, inherited from ML-family languages
  2. The Type System -- Hindley-Milner type inference, generics, GATs
  3. Abstraction Through Unit and Trait Impl -- A deep dive into the Unit type, generalizing built-in features, and extending them to user-defined types
  4. The Borrow Checker -- Ownership, lifetimes, and concurrency safety guarantees
  5. The Module System -- Visibility control and the rationality of use syntax
  6. Macros -- Metaprogramming with declarative and procedural macros
  7. Performance -- Execution performance through zero-cost abstractions and the LLVM backend
  8. Memory-Level Programming -- unsafe, bare metal, and the low-level world
  9. All-in-One Tooling -- The unity of the ecosystem centered on Cargo
  10. Cross-Building -- The world of cross-compilation, including WebAssembly and napi-rs
  11. 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.

Related

Back to book