Mastering Rust [PDF]

Mastering Rust
Mastering Rust

What this book covers

Chapter 1: Getting Your Feet Wet, deals with installing the Rust toolset and runs through basic language features in a speedy fashion.

Chapter 2: Using Cargo to Build Your First Program, focuses on the standard build tool, Cargo, and also other development tools and their editor integration.

Chapter 3: Unit Testing and Benchmarking, covers the standard testing tools and practices.

Chapter 4: Types, runs through details and practices related to Rust’s type system. We touch the different string types in Rust, arrays, and slices, traits, implementations, and generics.

Chapter 5: Error Handling, covers how Rust handles error conditions in a rather unique way. Rust does error handling through its generic type system, instead of relying on exceptions.

Chapter 6: Memory, Lifetimes, and Borrowing is possibly the most important chapter of the whole book. We see how Rust manages memory and resources, in general, in a safe way without relying on garbage collection.

Chapter 7: Concurrency, covers concurrent and parallel programming in Rust, and a few of the standard primitives (threads, channels, mutexes, and atomic reference counting) that can be used to implement safe concurrency.

Chapter 8: Macros, is where we start looking at the compile-time metaprogramming features of Rust. The so-called macros-by-example is the oldest and most stable form of metaprogramming in Rust.

Chapter 9: Compiler Plugins, goes through more advanced and newer metaprogramming features, such as linter plugins, custom derives, and code generation. Much of the content here relies on the nightly compiler.

Chapter 10: Unsafety and Interfacing with Other Languages, covers what kind of safety checks Rust has and how to circumvent them if needed. Interfacing with other languages is one place where we must instruct the compiler to relax some of its stricter checks.

Chapter 11: Parsing and Serialization, is where we look at a few ways of writing parsers. This chapter also touches on the standard Serde serialization framework.

Chapter 12: Web Programming, takes a look at basic backend web programming in Rust. We cover the low-level Hyper library for both client and server usage and check on the web framework situation by building a simple server-side game in Rocket.

Chapter 13: Data Storage, covers a few data storage options. We see how to build software with SQLite and PostgreSQLas data backends. We’ll cover connection pooling via the r2d2 library, and
lastly, we go through the Diesel ORM, followed by the summary of this chapter.

Chapter 14: Debugging, investigates using external debuggers for finding errors in Rust programs at runtime. We cover GDB and LLDB, and also GDB integration into the Visual Studio Code editor.

Chapter 15: Solutions and Final Words, contains short summaries of all the previous chapters for review purposes, followed by solutions to all the exercises in the book.

What you need for this book

To really dive into the content of this book, you should write out the example code and solve the exercises. For that, you’ll need a fairly recent computer: 1 GB of RAM should be enough for the
purposes of this book, but the more you have the faster the builds will be.

Linux is the best-supported operating system here, but Rust itself is also a first-class citizen on macOS and recent versions of Windows, so all the examples should adapt well there.

Who this book is for

The book will appeal to application developers who would like to build concurrent applications with Rust. Basic knowledge of Rust is assumed but not absolutely required.

You can also get this PDF by using our Android Mobile App directly:



Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.