Programming with Rust

Author:  Donis Marshall
Publisher: Addison-Wesley
Pages: 400
ISBN: 978-0137889655
Print: 0137889658
Kindle: B0CLL1TGVT
Audience: Programmers wanting to learn Rust
Rating: 3
Reviewer: Mike James
Rust is the language we all want to learn at the moment so this is just in time.

Rust is currently the great language hope to banish memory errors from programming. The only problem is that it makes use of some new ideas and as a result you probably need to rethink how to go about programming. Rumor has it that far too many Rust programmers continue to write programs using it as if it was C and escape the difficulties using unsafe blocks of code. There is a need for a good book on Rust.

Banner

This book is good in parts and it might suit your needs if you prefer a reference manual approach. That isn't to say that this book is all reference manual, but it does miss many opportunities to explain why something is like it is or how it differs from what you might already know.

After a brief introduction to programming paradigms and the major features of Rust, we get started with Hello World. There is a lot to take in and a lot of new jargon.

 

 

Chapter 3 is where the exposition of the language really starts with a look at variable types. This is fairly complete rather than being a gradual introduction of ideas - we go from integers to  pointers in not many pages. This is not for the complete beginner, but then most people wanting to learn Rust are probably moving on from C. Next we have a chapter on Strings and one on using the console, i.e. the Print command.

Chapter 6 digs into flow of control and it is another very complete statement of the possible control structures. There have already been many missed opportunities to highlight what makes Rust special or different. For example, Rust's for loop is nothing like C's and yet it is presented without the obvious comment that Rust does it slightly differently. As a result you might well keep wondering if a full C-style for is going to be introduced later - it isn't of course.  Chapter 7 continues along the traditional track with collections - arrays, vectors and hash maps.

It really is only at Chapter 8 do we get to anything that is central to what makes Rust different - ownership. Chapter 9 continues the related theme with a look at lifetimes. These two features are what most programmers will want to know all about, but the coverage is very short. I would liked a longer discussion with more examples, especially of how things go wrong. I think you will leave these two chapters thinking you have mastered the ideas until you actualy try to make use of them.

From this point the book continues along a fairly standard road that would be followed irrespective of the language. Chapter 10 is on references and includes a consideration of borrowing. Chapter 11 is on functions, 12 on error handling, 13 on structures, 14 on generics, 15 patterns, 16 closure, 17 traits, 18 and 19 are on threads, 20 is on memory, 21 macros, 22 interoperability - with C in particular and 23 closes the book with a look at modules.

Verdict

This is a book that is going to disappoint both the reader looking for a reference style presentation and the reader looking for an informal account. It tends to present everything on a topic rather than starting simple preparing the ground for meeting the more advanced or esoteric ideas later. There is also a lot of forward referencing due to this approach. Some parts are better than others in making it clear how Rust differs from other languages, but there are also lots of places were a few words contrasting it with C or Python would help the reader.   

 

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.

Banner


The Async-First Playbook

Author: Sumeet Gayathri Moghe
Publisher: Addison-Wesley
Pages: 368
ISBN: 978-0138187538
Print: 0138187533
Kindle: B0CCTZHB9N
Audience: Agile developers
Rating: 4
Reviewer: Kay Ewbank

The driver behind this book was the pandemic and the need to find ways to make remote working effective for teams. So do [ ... ]



Modern Software Engineering (Addison-Wesley)

Author: David Farley
Pages: 256
ISBN: 978-0137314911
Print:0137314914
Kindle: B09GG6XKS4
Audience: Software Engineers
Rating: 3.5
Reviewer: Kay Ewbank

This book is subtitled 'doing what works to build better software faster' - does it teach you how to achieve that?


More Reviews

Last Updated ( Tuesday, 26 March 2024 )