Rust in Action
Disclaimer: this post includes affiliate links; I may receive compensation if you purchase the book from the different links provided in this post.
I’m pretty much a learning-by-doing kind of guy. However, I tend to get back to documentation after a certain level. Last year, I started to learn the Rust programming language on my own. Then, I felt the need to read some theories.
I have known the “In Action” Manning series for a long time. When I saw Rust in Action, I thought it would be a step in this direction.
- 12 chapters, $33.59
- The book’s subtitle is “Systems programming concepts and techniques”. Unlike most subtitles, it does describe the book’s content: I’ll come back to it later.
Chapters are divided into two main sections: Rust language distinctives and Demystifying systems programming. Here’s a quick overview of each chapter:
- Introducing Rust. The title says it all. It’s worth mentioning that the author dedicates a section to downsides. For me, it’s essential as it shows intellectual honesty.
- Language foundations. The chapter starts to lay out the basics of Rust syntax. It also describes how to compile.
- Compound data types. The chapter describes structures and enumerations. The last section also includes how to generate documentation.
- Lifetime, ownership, and borrowing. The most important chapter in any Rust book!
- Data in depth. The chapter marks the start of the section about system programming. It describes how an operating system models data. Throughout the chapter, the author goes through the concepts via the use-case of building a virtual CPU.
- Memory. Stack, heap, pointers, and smart pointers
- File and storage: I stopped reading during this chapter.
- Time and timekeeping
- Processes, threads and containers
- Signals, interrupts and exceptions
Pros and cons
Note that as I mentioned above, I stopped reading the book halfway through it. Hence, my view only reflects the parts I read.
The good sides of the book are:
- The author is objective about the Rust language, mentioning its downsides. It’s pretty rare and deserves to be mentioned.
On the flip side:
- The order in which themes are described doesn’t always make sense. For example, the author describes
cargoin detail in the first chapter, whereas some basics of the Rust syntax come only much later. Likewise, he explains how to generate documentation in the second chapter.
- Some themes are dispatched in different chapters without any reason I can fathom. The bulk of Rust’s documentation system is described in the second chapter, but then chapter 3 dedicates its last section to creating inline documentation.
- There’s no use-case across different chapters. Every chapter brings its own, which you need to understand. Some chapters even have different use-cases for each section, requiring a lot of context switching.
- Last but not least, the book tries to teach two things at once: Rust and system programming. The thing is, it’s not feasible, as it should be one or the other. If you’re already familiar with system programming, then the Rust part should be pretty straightforward; if not, as it’s my case, then it’s too much content.
As I mentioned, I started to learn Rust on my own. Hence, I was very eager to consolidate and complete my understanding by reading a book, such as Rust in Action. Perhaps, for this reason, I was expecting too much. But my opinion is that the book tries to teach too much at once. A whole book could focus on the system programming part only. In its current form, the book tries to cover too much ground.
Even if you are already familiar with system programming, the book is hard to read. The two primary reasons for that are a lack of a unified use case and suboptimal dispatching of themes across the different chapters.
In conclusion, if you’re already familiar with low-level programming and are trying to learn Rust, it might be the right book. If you’re not, it will take a lot of effort to go through all content.
Originally published at A Java Geek on April 10th, 2022