The Rust Programming Language The Rust Programming Language Foreword Introduction Getting Started Installation Hello, World! Hello, Cargo! Programming a Guessing Game Common Programming Concepts Variables and Mutability Data Types Functions Comments Control Flow Understanding Ownership What is Ownership? References and Borrowing The Slice Type Using Structs to Structure Related Data Defining and Instantiating Structs An Example Program Using Structs Methods Enums and Pattern Matching Defining an Enum The match Control Flow Construct Concise Control Flow with if let and let...else Packages, Crates, and Modules Packages and Crates Control Scope and Privacy with Modules Paths for Referring to an Item in the Module Tree Bringing Paths Into Scope with the use Keyword Separating Modules into Different Files Common Collections Storing Lists of Values with Vectors Storing UTF-8 Encoded Text with Strings Storing Keys with Associated Values in Hash Maps Error Handling Unrecoverable Errors with panic! Recoverable Errors with Result To panic! or Not to panic! Generic Types, Traits, and Lifetimes Generic Data Types Defining Shared Behavior with Traits Validating References with Lifetimes Writing Automated Tests How to Write Tests Controlling How Tests Are Run Test Organization An I/O Project: Building a Command Line Program Accepting Command Line Arguments Reading a File Refactoring to Improve Modularity and Error Handling Adding Functionality with Test Driven Development Working with Environment Variables Redirecting Errors to Standard Error Functional Language Features: Iterators and Closures Closures Processing a Series of Items with Iterators Improving Our I/O Project Performance in Loops vs. Iterators More about Cargo and Crates.io Customizing Builds with Release Profiles Publishing a Crate to Crates.io Cargo Workspaces Installing Binaries with cargo install Extending Cargo with Custom Commands Smart Pointers Using Box<T> to Point to Data on the Heap Treating Smart Pointers Like Regular References Running Code on Cleanup with the Drop Trait Rc<T>, the Reference Counted Smart Pointer RefCell<T> and the Interior Mutability Pattern Reference Cycles Can Leak Memory Fearless Concurrency Using Threads to Run Code Simultaneously Transfer Data Between Threads with Message Passing Shared-State Concurrency Extensible Concurrency with Send and Sync Fundamentals of Asynchronous Programming: Async, Await, Futures, and Streams Futures and the Async Syntax Applying Concurrency with Async Working With Any Number of Futures Streams: Futures in Sequence A Closer Look at the Traits for Async Futures, Tasks, and Threads Object Oriented Programming Features Characteristics of Object-Oriented Languages Using Trait Objects to Abstract over Shared Behavior Implementing an Object-Oriented Design Pattern Patterns and Matching All the Places Patterns Can Be Used Refutability: Whether a Pattern Might Fail to Match Pattern Syntax Advanced Features Unsafe Rust Advanced Traits Advanced Types Advanced Functions and Closures Macros Final Project: Building a Multithreaded Web Server Building a Single-Threaded Web Server From Single-Threaded to Multithreaded Server Graceful Shutdown and Cleanup Appendix A - Keywords B - Operators and Symbols C - Derivable Traits D - Useful Development Tools E - Editions F - Translations of the Book G - How Rust is Made and “Nightly Rust”