Programming Rust

Author: Jim Blandy and Jason Orendorff
Publisher: O'Reilly
Date: Aug 2016
Pages: 400
ISBN: 978-1491927281
Print: 1491927283
Kindle: B077NSY211
Audience: Systems programmers
Rating: 4
Reviewer: Mike James
Rust - it's a hit language of the moment. The language we all love to love. So what could be better than an in-depth explanation by two Rusty experts.

We all know the problems with the number one systems language, C. It is dangerous because you can very easily write poor code that is buggy and vulnerable to attack. Still it, or its big brother C++,  is the basis for most of our "serious" software. What this means is that despite its problems any language that hopes to replace C has to have a lot going for it. Arguably Rust has but it can be difficult to find out exactly what it is. Programming Rust is not a beginners book and its main aim seems to be to convince you that Rust is the right way to program.

There is a problem however. Rust has some new aspects, ownership in particular, that can make it difficult to do things that you know how to do in other languages. It is not that Rust stops you doing them, it is more that it stops you doing them in ways that you would have done them in other languages. This book starts off with the idea that not only do you know how to program, but you have to have a reasonable grasp of Rust to understand the arguments and examples.

In short this is not the place to start learning Rust.


We start off with a general look at Rust and type safety in Chapter 1. Then Chapter 2 gives you a tour of the language and its important facilities. The trouble with this is that, if you don't know Rust, it can be difficult to follow. It also has a lot of forward references that really don't make much sense. At best at the end of the chapter you have a "feeling" for Rust. 

Chapter 3 goes over the basic types - much like any logically organized quick guide to a language would - but in this case it isn't quick. There is still much explanation of why things are like they are and again much forward referencing.

Chapter 4 is on the key idea of ownership, but rather than first giving you the rules - the big picture - it introduces the twists and exceptions as an extended story. By this point in the book I realized that I was not reading a logically sequential introduction to the language. In other word, this is not the K&R of Rust. In fact, it got so bad that at the end of the chapter I was unsure that I really understood ownership. The problem is that, without a complete statement of the rules, you leave the chapter thinking what other edge cases are lurking? Chapter 5 continues in the same way looking at references and it has the same problem.

Chapter 6 focuses on expressions which is not so different from other languages, but you still need to keep an eye on when things get different - the fact that nearly everything, including flow of control, is an expression, for example. 

From this point on things settle down into a more or less standard pattern - there are fewer big ideas to learn and more "exactly how is this done" explanations. Chapter 7 is on error handing and Rust's version of exceptions. Chapter 8 is on creates and modules - personally I would have preferred this chapter later in the book. Chapter 9 introduces structs, even though we have been making a lot of use of them earlier. Chapter 10 on enums may look like familiar ground, but only if you are used to using patterns. Chapter 11 deals with traits and generics -  Rust is object-oriented, sort of, but it's not quite what you might expect so read carefully. Chapter 12 is about  operator overloading; 13 is about traits again; 14 is about closures and deals with some of the problems; 15 is about iterators; 16 is about collections; 17 is about strings and is possibly a bit late; 18 is about I/O, a messy subject in any language; 19 is about concurrency, which has been lurking the background from the start; 20 is on macros; and, finally, 21 deals with unsafe code and how to get rid of all the protections Rust provides if you really have to.  

If you find that your favorite chapter is 21, on unsafe code and writing code like you would in C,  then you probably need to go back to the beginning and read it all again. In fact, this is probably what you have to do even if you got enough  of the ideas to make 21 your least favorite chapter.

This is a very wordy and discursive book. It wanders and rambles over topics in an attempt to educate you about how to think about Rust. This probably works if you already know enough Rust not to struggle with reading the examples; or are enlightened to discover why things work like you already know they work. Occasionally the evangelism goes a tiny bit too far and you think "I'm already into Rust - stop trying to convince me so hard!"

If you already program in the language, this is a book you probably need on your Rusty bookshelf, no matter what you think of it, but you need something else to present the language to you in a logical order, complete with the rules that cover the edge cases.

If you are Rust beginner this is most probably not the book for you, unless you don't mind reading, reading ahead, going back re-reading and so on.

If you are a C or C++ programmer there are a lot of new ideas to absorb and if you don't succeed in understanding then you are probably going to go back to C or C++ even if you continue writing in Rust.

A qualified recommendation as a must-have book for the Rust programmer.

See also my review of

The Rust Programming Language

This is the "standard" book on Rust written by members of its developent team. I gave it a rating of 4.8, concluding: 

The book is good and highly recommended, but it isn't a quick introduction for competent programmers wanting to know the key ideas of Rust.  

To keep up with our coverage of books for programmers, follow @bookwatchiprog on Twitter or subscribe to I Programmer's Books RSS feed for each day's new addition to Book Watch and for new reviews.


Learn Java the Easy Way

Author: Dr. Bryson Payne
Publisher: No Starch Press
ISBN: 978-1593278052
Print: 1593278055
Kindle: B0713P1RBH
Audience: Java Programmers
Rating: 2
Reviewer: Mike James

Who could resist an easy way to learn anything?

TensorFlow 2 Pocket Primer

Author: Oswald Campesato
Publisher: Mercury Learning
Pages: 252
ISBN: 978-1683924609
Print: 1683924606
Kindle: B07XD5R1XZ
Audience: Data Scientists, AI etc.
Rating: 4
Reviewer: Mike James
A small book on TensorFlow - good idea?

More Reviews

Last Updated ( Saturday, 27 April 2019 )