The Rust Programming Language (Covers Rust 2018)

The Rust Programming Language (Covers Rust 2018)

by Steve Klabnik and Carol Nichols
August 2019, 526 pp.
Lay-flat binding

Look Inside!

The Rust Programming Language (Covers Rust 2018)The Rust Programming Language (Covers Rust 2018)The Rust Programming Language (Covers Rust 2018)The Rust Programming Language (Covers Rust 2018)The Rust Programming Language (Covers Rust 2018)

Download Chapter 2: Programming a Guessing Game

The Rust Programming Language is the official book on Rust: an open source systems programming language that helps you write faster, more reliable software. Rust offers control over low-level details (such as memory usage) in combination with high-level ergonomics, eliminating the hassle traditionally associated with low-level languages.

The authors of The Rust Programming Language, members of the Rust Core Team, share their knowledge and experience to show you how to take full advantage of Rust’s features—from installation to creating robust and scalable programs. You’ll begin with basics like creating functions, choosing data types, and binding variables and then move on to more advanced concepts, such as:

  • Ownership and borrowing, lifetimes, and traits
  • Using Rust’s memory safety guarantees to build fast, safe programs
  • Testing, error handling, and effective refactoring
  • Generics, smart pointers, multithreading, trait objects, and advanced pattern matching
  • Using Cargo, Rust’s built-in package manager, to build, test, and document your code and manage dependencies
  • How best to use Rust’s advanced compiler with compiler-led programming techniques

You’ll find plenty of code examples throughout the book, as well as three chapters dedicated to building complete projects to test your learning: a number guessing game, a Rust implementation of a command line tool, and a multithreaded server.

New to this edition: An extended section on Rust macros, an expanded chapter on modules, and appendixes on Rust development tools and editions.

Author Bio 

Steve Klabnik leads the Rust documentation team and is one of Rust’s core developers. A frequent speaker and prolific open source contributor, he previously worked on projects such as Ruby and Ruby on Rails. Klabnik works at Mozilla.

Carol Nichols is a member of the Rust Core Team and co-founder of Integer 32, LLC, the world’s first Rustfocused software consultancy. Nichols organizes the Rust Belt Rust Conference.

Table of contents 


Chapter 1: Getting Started
Chapter 2: Programming a Guessing Game
Chapter 3: Common Programming Concepts
Chapter 4: Understanding Ownership
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
Chapter 15: Smart Pointers
Chapter 16: Fearless Concurrency
Chapter 17: Object-Oriented Programming Features of Rust
Chapter 18: Patterns and Matching
Chapter 19: Advanced Features
Chapter 20: Final Project: Building a Multithreaded Web Server

View the detailed Table of Contents
View the Index


"Covers everything you could want to know about the language."
Stack Overflow

"The book . . . provides information on how developers can get started with Rust."
—Tiera Oliver, Embedded Computing Design

"I'd learned @rustlang back in late-2019 and referred [to The Rust Programming Language]. It's written very well, and is still relevant if you want to refer to."
—Trivikram, @trivikram

"A thing of beauty in a world full of dry arcane texts."
—Garrett Mace, @macegr

"My main learning resource."
—Pawel Grzybek, @pawelgrzybek, Software Engineer

Extra Stuff 

Download the source code for the previous edition of The Rust Programming Language

Check out this interview in Nature with co-author Carol Nichols on why scientists are turning to the Rust programming language.