I'm learning Rust
I have a little bit of time off in this moment, before the end of the year, so I decided to learn Rust. I started with "Rust in Action" (https://www.manning.com/books/rust-in-action ) by Tim McNamara. The book has been published at Manning, in 2021 and, given the fast evolution of the Rust ecosystem, one might think that almost 3 years later, the book must be outdated nowadays. But I decided to start with this title anyway, as it's presented as one of the Rust bible.
I've been disappointed and, accordingly, I won't recommend this book as I found the text quite confusing. The author does a great job by trying to go into the most basic language's details, syntax sugar and features but doesn't cover the Rust's ecosystem set of tools.
You learn from the first pages (Chapter 1 - Introducing to Rust) that there would be something called Cargo, allowing you to compile your code and to declare ans resolve dependencies, probably a build utility like maven or gradle, but you learn it at a turn of phrase, as the author doesn't feel the need to really put a too fine point on it.
Chapter 2 - Language foundations, shows you how to declare variables, functions, deals with different number types and flow control and illustrates these basic concepts with a very hermetic example showing you how to create pictures and fractals. This example, which listing requires two pages, doesn't bring anything, as far as the Rust learning process is involved.
Chapter 3 - Compound Data Types, talks about file I/O operations among others but, instead of covering the standard library functions, as one would have expected, the author shows us how to model file I/O operations using structs. Later, when it comes to talk about traits, which is one of the Rust's fundamental concepts, the author stops at defining it as follows:
"Traits have close relatives in other languages. These are often named interfaces, protocol, type classes, abstract classes or, perhaps, contracts".
That's all that you'll find as traits definition.
领英推荐
In Chapter 4 - Lifetimes, ownership and borrowing, the author does a rather good job by describing the Rust's borrowing mechanics but, the next one, Chapter 5 - Data in Depth, puts the focus on things like representing decimal, fixed-point and floating point numbers, which don't help much to learn Rust. The whole is illustrated by an example of how to implement a CPU, which is way too complex for being included in a book dedicated to the beginners and, additionally, doesn't have any interest as only very few readers are implementing CPUs at the drop of the hat.
But the big surprise comes at Chapter 6 - Memory, where the reader learns, by just seeing the Figure 6.4, that there exists things called "reference counted pointers", like Rc<T>, Arc<T>, RefCell<T>, Vec<T>, etc. These Rust fundamental concepts benefit from exactly zero explanations, which is really unexpected, to say the less, for this kind of book, which is supposed to be a Rust reference.
Chapter 7 - Files and Storage, doesn't show how to use the standard library functions in order to manipulate the file system, as the reader would have expected, but, instead, it demonstrates how to implement a customized key-value store, should you need to implement one, instead of using the standard one.
Chapter 8 - Networking, doesn't show you how to use the standard library TCP functions but, instead, how to generate MAC addresses. This would have been the right place to discuss about HTTP and things like Tokio and Warp but these notions aren't covered. Reqwest is mentioned however, but only vaguely.
Chapter 10 - Processes, threads and containers, succeeds to explain closures but illustrates them with irrelevant examples like generating avatars.
My conclusion is that you won't learn much Rust by reading this book, but you will admire the author's skills to implement high complexity examples, way too complex for the chosen purpose, which don't have much with the book's scope. The books completely lacks things like web applications development, micro-services, REST API, database persistence, security, unit/integration testing, etc.
Senior Auditor
11 个月To the point!