Jump to ratings and reviews
Rate this book

The Rust Programming Language

Rate this book
The Rust Programming Language is the official book on Rust, an open-source, community-developed systems programming language that runs blazingly fast, prevents segfaults, and guarantees thread safety. This is the undisputed go-to guide to Rust, written by two members of the Rust core team, with feedback and contributions from 42 members of the community. The book assumes that you’ve written code in another programming language but makes no assumptions about which one, meaning the material is accessible and useful to developers from a wide variety of programming backgrounds.
Known by the Rust community as “The Book,” The Rust Programming Language includes concept chapters, where you’ll learn about a particular aspect of Rust, and project chapters, where you’ll apply what you’ve learned so far to build small programs. 
The Book opens with a quick hands-on project to introduce the basics then explores key concepts in depth, such as ownership, the type system, error handling, and fearless concurrency. Next come detailed explanations of Rust-oriented perspectives on topics like pattern matching, iterators, and smart pointers, with concrete examples and exercises--taking you from theory to practice.
The Rust Programming Language will also show you how to:
- Grasp important concepts unique to Rust, like ownership, borrowing, and
- Use Cargo, Rust’s built-in package manager, to build and maintain your code,
  including downloading and building dependencies
- Effectively use Rust’s zero-cost abstractions and employ your own
You’ll learn to develop reliable code that’s speed and memory efficient, while avoiding the infamous and arcane programming pitfalls common at the systems level. When you need to dive down into lower-level control, this guide will show you how without taking on the customary risk of crashes or security holes and without requiring you to learn the fine points of a fickle toolchain.
You’ll also learn how to create command line programs, build single- and multithreaded web servers, and much more.
The Rust Programming Language fully embraces Rust’s potential to empower its users. This friendly and approachable guide will help you build not only your knowledge of Rust but also your ability to program with confidence in a wider variety of domains.

552 pages, Kindle Edition

Published July 10, 2018

Loading interface...
Loading interface...

About the author

Steve Klabnik

7 books34 followers

Ratings & Reviews

What do you think?
Rate this book

Friends & Following

Create a free account to discover what your friends think of this book!

Community Reviews

5 stars
632 (56%)
4 stars
392 (34%)
3 stars
91 (8%)
2 stars
8 (<1%)
1 star
1 (<1%)
Displaying 1 - 30 of 128 reviews
Profile Image for Bill de hÓra.
10 reviews36 followers
December 16, 2018
(book also online at https://doc.rust-lang.org/book). If you’re looking to learn or explore Rust, this is the book to start with. The book works through the language feature area by feature area, with minimally sized code snippets - the focus is on explanation through the text instead of reams of code. Instead, much of the technical content that the authors use for teaching purposes are compiler error messages, which cleverly leverages one of the language’s best features, and one programmers will spend a lot of time with in practice (Rust has quite clear compiler messages).

Overall the content is well laid out with minimal forward references. There’s a lot of emphasis given to the concept of of ownership, borrowing and lifecycles, which are the most novel aspects relative to other languages. The sections on testing, generics/traits, pattern matching, and object oriented programming, are particularly strong. I would have liked to have seen function pointers covered earlier in the initial section on functional language features, and extended coverage on references, but these are minor enough, and what’s there is enough to get the gist.

Every now and then you come across a software book that’s enjoyable for its own sake, The Rust Programming Language is one of those books - not just an excellent introductory book on Rust but an exemplar of technical writing.
Profile Image for Nick Black.
Author 1 book704 followers
October 21, 2020
as i postpended to my review of The C Programming Language, after twenty years of writing C and C++ professionally and ten years' amateur work prior, i have adopted Rust, and thus the first language i've found that is all of (1) generally applicable to my kind of systems+numerical programming, (2) superior to C, and (3) superior to C++ (i consider the two to be only weakly ordered). i expect to use it for the next thirty years or so. this is a solid introduction to Rust, but lacks the sublime. experienced programmers needn't read it to effectively use Rust, though it certainly won't hurt. i was hoping for more. Stroustrup's The C++ Programming Language is full of wisdom that transcends a language reference; K&&R is too short to carry much beyond one. tRPL spends too much time giving pithy pedestrian advice, and not enough text exhaustively covering the language and its runtime. its lack of greatness, however, is due to rising above neither reference nor speller; there is nothing here to leave a master with a piquant memory.

with that said, baller move making it freely available.
Profile Image for Jindřich Mynarz.
110 reviews12 followers
February 3, 2019
I have no plans to write Rust, yet I appreciated the book. Its clarity of writing is exceptional and the Rust's concepts are introduced in an instructive way. Even as a person who develops in more declarative, higher-level, dynamic, and garbage-collected languages I found the book useful as its explains many of the underlying low-level aspects of computing, such as reference counting.

Rust follows the principle of "zero-cost abstraction", where the cost means performance cost, which is obviously achieved at some cognitive cost to the developer. Even though Rust tries to limit the cognitive overhead, often I found myself thinking there's way too much syntax in it. However, I think people coming to Rust understand and accept that with its great power comes some cognitive tax.
Profile Image for Arun.
154 reviews34 followers
August 12, 2021
I have been using rust at work comfortably before reading this book and knew everything talked about in the book either from trial and error or from reading blogs/open source code etc. But completing this book is like a rite of passage for rustaceans so I decided to give it a shot. If you are already doing s/w eng. for a while, it doesn't shock you with grandeur wisdom but admittedly the prose style is beautiful that one can read it like a well written novel and consider that time well spent.
Profile Image for Greg Stoll.
306 reviews10 followers
July 4, 2021
An excellent way to learn Rust, with some fairly meaty topics to boot. Every time I read through the book again I learn something!
Profile Image for Sebastian Gebski.
935 reviews809 followers
November 30, 2018
*** Important. This is the review of the 2nd Edition - a complete re-write of the original book ***

Disclaimer #1: You can read the book here: https://doc.rust-lang.org/book/ - for free. I've reviewed the Kindle version by NoStarchPress.
Disclaimer #2: I was familiar with Rust before reading the book, so for me it was just a great opportunity to review the syntax, idioms, etc.

This book "implements" my favorite approach to teaching programming languages - it's not a dry review of syntax, but also it's not a selective description of particular statements based on cryptic, pseudo-real programs. What is it then? A healthy compromise, with awesome examples. The start is smooth (but you should have a prior experience with some programming language) & it's aimed to set you up properly, not to make you an expert. What I really liked was the description of the most tricky aspects of Rust: ownership & lifetimes - truly decent job! The worst chapter is probably the concurrency one - felt overloaded & a bit unclear - in terms what's consider as an idiomatic approach in Rust.

But still - if you're about to start your journey with Rust, this book is a great choice.
Profile Image for Sebastian Gebski.
935 reviews809 followers
November 16, 2019
The best Rust reference book I know.
I've re-read the latest version (the one that covers Rust 2018) & it's still stellar - easy to understand (even more tricky topics - like lifetimes or traits), concise, illustrated with good code samples.
It's already a bit outdated (async-await support is not present), but still - it's the most up-to-date book resource available.

What I didn't like? NoStarch has provided no option to upgrade the previous edition. And they didn't answer my inquiries. I've read 2018 ed. only because I had a "free" access to it on the O'Reilly platform.
Profile Image for Utsob Roy.
Author 2 books65 followers
September 18, 2021
তো, আমি তো কোনোকালেই সিস্টেম প্রোগ্রামার না। ইউজার-ফেসিং জিনিসপত্র নিয়েই আমার কারবার। সিম্পলি মন চায় বলে এটা ওটা ঘেঁটে দেখি। আগে একবার রাস্ট অ্যাপ্রোচ করেছিলাম, তখন ভালো লাগেনাই। এই বইটা পড়ে বরং ভালো লেগেছে।

অধুনাকালে জনপ্রিয় দুটো ল্যাঙ্গুয়েজ আমারও ভালো লেগেছে। গো- মিনিম্যালিস্ট অ্যাপ্রোচ আর কনকারেন্সির জন্য, ডার্ট-সিনট্যাক্সের জন্য।

তো, রাস্ট ভালো লেগেছে কয়েকটা কারনে। ম্যাচ সিনট্যাক্স, সেফটি ফিচারস, ভালো কম্পাইলার, আর বিল্ড সিস্টেম। তাছাড়া গো-এর মত ওওপি-এর কম্পোজিশন-বেজড অ্যাপ্রোচ।

বইটা রেকমেন্ডেড কেননা লেখা স্বচ্ছল, ভালোভাবে অনেককিছু এক্সপ্লেইন করা আছে।
Profile Image for Ricardo Signes.
55 reviews4 followers
November 6, 2015
It's a totally decent book to explain the basics of Rust. I like Rust. Rust might be a big deal, but this book isn't an amazing piece of technical writing. It's just good.
Profile Image for Lucas.
130 reviews24 followers
April 28, 2021
Meu primeiro contato com rust. É uma linguagem fantástica. É impressionante a consistência lógica de tudo. Mas, ao menos para mim, é a linguagem mais difícil que tive contato até aqui. Isso não deve surpreender. Até hoje trabalhei apenas com linguagens de alto nível e nunca precisei me preocupar se um objeto que estava manipulando ficava no stack ou no heap. O estranhamento é natural, portanto.

Certamente seu estranhamento será menor que o meu se você é um programador de C.

Se você nunca programou em outra linguagem, minha sugestão é começar por uma de alto nível.

Apesar da dificuldade, que também se relaciona com a necessidade de aprender novos conceitos (se você vem de python: struct, enum; se você vem de qualquer outra linguagem: borrowing), o livro é extremamente bem escrito com leitura super acessível. Eu aprendi muito, mas vou precisar voltar de tempos em tempos em cada capítulo que li.

Se você quer aprender rust, eu não vejo outra forma que não lendo esse livro. Não conheço nenhum curso online de boa qualidade e "meter a cara" na linguagem, como eu fiz, vai causar muita frustração, posso garantir.
Profile Image for Charlie.
2 reviews
September 16, 2020
a must-read introduction to rust. this book contains concise yet thorough explanations of features unique to rust. the writing is excellent and the complexity of the examples is "just right". and it's freely available!

i'd say it does assume both prior coding experience and a little computer architecture knowledge (e.g. stack vs. heap, pointers, etc.), so a complete beginner might struggle to follow. that said, rust itself is probably not the ideal first programming language.

learning rust definitely will change how you think about programs. and this book is the perfect way to get started
Profile Image for Matt.
119 reviews19 followers
November 13, 2019
I thought this was a great way to get into Rust. The examples are good and the explanations are clear.
Profile Image for David.
91 reviews2 followers
February 9, 2020
Pretty typical programming language intro book. It’s well written and thorough — enough to be a useful reference later on.
7 reviews
October 3, 2021
Just what I would expect from a book of this type. Very well written with lots of useful snippets that help with grasping the concepts.
Profile Image for Dana Larose.
376 reviews14 followers
January 30, 2020
A very good introduction to Rust, a programming language which, after reading the book, I am pretty sure I am too dumb to ever be any good at. The explanations were clear but several concepts I still don't quite get. Lifetimes, for instance, and Rust's implementations of closures. But I think that's me being thick-headed not the book being unclear.

I feel like the current version (as of January 2020) is a little bit out of date because the Rust community is making a big deal out of async/await being added to the language (I believe in the fall) and the book currently doesn't speak of it at all.

But I'm committed to trying at least one decent-sized project in Rust this year. I'll come back and give a star rating to the book depending on if the project is a success or a failure :P
June 18, 2022
Very good and easy read! I wish it had more coding exercises so I would have had more opportunities to practice. Copying the code from the examples and then running it gets pretty boring.
Profile Image for Marko Kunic.
20 reviews1 follower
January 28, 2019
The best introduction to a new language I ever saw. I tried learning a lot of new languages in the past few years but this is the only one I actually enjoyed. This book is amazing, wanna learn rust? Start here.
Profile Image for Matt.
198 reviews
June 7, 2022
This book presents a very easy to follow introduction to Rust. It seems like a very cool programming language, and includes features such as:

- Immutability: All variables are immutable by default, and must either be consumed when used, or explicitly marked as mutable. This prevents code state from changing in unpredictable and hard-to-track ways.
- Ownership: Only one function can have ownership of a variable at a time, which prevents memory issues. Other functions can have either mutable or immutable references to the variable, but the compiler forces a max of one mutable reference (with no simultaneous immutable references).
- Enums: The way enums are handled in Rust is really cool, and feels like a combination of the Enum and Union types in Python.
- Option: The Option type forces explicit checking for None whenever such a return type is possible.
- Error Handling: Rust forces error checking, and the simple syntax for passing errors back up to calling functions is really cool.
- Traits: This is like the Protocol type in Python, and seems very useful.
- Lifetimes: I don't understand how to use lifetimes yet, but I can see why they might be useful.
- Tests: The way Rust sets up testing is very easy to use, and solves a lot of the problems I have with large unit testing suites in Python.
- Closures: The built-in support for lazy evaluation using closures is pretty nice, and looks like it could save some time when evaluating code.
Profile Image for John Faucett.
4 reviews
June 26, 2020
I'm sure its hard to write a book about a whole programming language - especially one as complicated as rust, where you also don't know the skill levels of all the potential readers. And I think the author does a decent job managing all of this. The book will teach you the basics of rust and give you a glimpse into some of the things you can accomplish. It will not get you to a point where you can develop production software in rust - you will still need to read up all the docs and explore libraries on your own. It also won't teach you through doing a lot of projects. It does have a few projects you work through but most of the book is spent explaining a concept and giving you a few examples of how that concept works. In general, I think for me the book was a bit too verbose for what it explains, but maybe if you are just starting out with programming you need the detailed textual explanations. Overall, I'd say the book is a good introduction to the language but if you have been programming for a long time you will probably find it too verbose.
379 reviews6 followers
April 27, 2016
Rust è un linguaggio con diversi concetti mai implementati in altri linguaggi (lifetime delle variabili, autoderefenziazione di "puntatori", ecc.), e purtroppo questo manuale non riesce a spiegarli in modo comprensibile, scadendo troppo spesso in concetti matematici, o cercando di spiegare gli internals del compilatore prima di essere riuscito a spiegare il concetto o semplicemente l'uso di certi costrutti.

La continua riorganizzazione dei capitoli, poi, ha portato ad avere frasi tipo "come abbiamo spiegato nel capitolo relativo a..." che in realtà è 6 o 7 capitoli più avanti.

Gli unici vantaggi sono che è completamente gratuito (anche se trovare una versione in epub o pdf da leggere offline è quantomeno complicato) e che si possono segnalare errori o anche contribuire a migliorarlo.
Profile Image for Jon Ureña.
Author 3 books92 followers
August 14, 2019
If you are like me, you might occasionally remember that you are a programmer by trade, and you might have come up with some cool game idea that might be generally classified as a roguelike or half-assed clone of "Dwarf Fortress". In those instances you might want to look into which programming languages are currently in vogue.

You need a different programming language depending of what you intend to do, because every language limits you in some way or another. If you want to get something done quick, you don't like complicated language constructs nor want to delve into the nitty gritty of memory and data ownership management, or want to train some neural network, you likely want Python. Some years back it used to be stuck in a previous generation of languages, but because plenty of big names in the industry realized that it was the right thing for teaching machines how to be smarter than people, Python has gone through a revolutionary update. However, beyond leaving a computer training for hours, days or weeks, you won't find many solid apps or games that use that language, mainly because it can be very resource intensive or wasteful, but also particularly because of the damned GIL, the Global Interpreter Lock. As you reading this surely know, modern computers have different processing cores which divide their particular workload in different threads. Turns out that when Python was designed, most if not all computers had a single core, so having to build multicore apps wasn't a thing. However, these days you need to take advantage of all cores for all but the most simple applications, or scripts that you can leave running for a long time like those involved in artificial intelligence. If you are programming let's say a game or a simulation that involves loads of agents running around, each making pathfinding requests that shouldn't kidnap a single core for more than a hundred milliseconds each or less, you'll end up hating the GIL: it effectively blocks memory sharing between different cores, so if you need to pass the state of an entire map to a different core, which can involve around 5-8 MB, you'll block the program for as long as the information is copied to other memory addresses. That won't do. There are workarounds, but only when the data involved isn't too big. In the end you are making the language jump through hoops that it isn't built to do.

If you intend to program heavy apps that aren't real time resource intensive, such as websites or desktop apps, you usually can do with Java or JavaScript, which are for the most part, despite some upgrades, boring. If you are going for the big leagues and want to write a game with multiple agents doing shit in parallel, you have always been pushed towards C++, which is old as fuck, terribly cumbersome, lacking modern features of most modern languages, and worst of all, you need to anticipate and avoid low level pitfalls like buffer overflows, data races (when at least two threads attempt to write in and read the same memory address), deadlocks (when a thread is waiting for another one to unblock access to a memory address, like two guys in contiguous bathroom stalls waiting for the other to finish shitting and leave) and pointers that send you to addresses with nothing in them or with entirely unrelated data. Still, if you were writing a serious game, you need to know C++.

Fortunately, things seem to be changing. Rust has been built as a modern substitute for C++. It's strongly typed and low-level in comparison with the likes of Python, but it's blazingly fast partly because it doesn't have a garbage collector, it can take advantage of every processing core, and most importantly, the design of the language makes it impossible that you can leave a pointer dangling, cause a buffer overflow or a data race. To make this possible, setting ownership of data and how much it lasts is a main feature of the language you'll have to deal with, but it's a very small price to pay to avoid most of the main irritations of C++. Additionally, a crating system makes handling, linking, uploading and installing libraries a breeze. You can easily create a workspace with many different crates that link to each other, and a single command in the workspace will run all the test suites, compile all the libraries and run the executable. The language keeps improving and people are building more and more libraries for it, so I imagine that it will only get more notoriety.

If you want to start programming that ambitious game that you'll probably just quit developing in a matter of weeks because you'll get distracted by something else, it seems like the right time to look into Rust.
Profile Image for Nathan H..
50 reviews
February 17, 2022
This was a solid primer of the Rust language for more experienced programmers (i.e. some background knowledge in actual CS and language design is helpful here — heap vs. stack allocation, interfaces vs. classes, etc. — since the book doesn't explain the details/tradeoffs in great detail and focuses more on the language itself).

I read a chapter every other day or so and finished the book in about two months. The chapters were organized well and called back to previous material in logical ways so it was easy to follow and maintain context even though I wasn't reading every single day.

Lifetime parameters were probably the hardest thing for me to understand about the language. Other than that, I was familiar with a lot of the other features from languages I've worked with previously (patterns from Haskell, destructuring from JavaScript, etc.) and the book did a good job of explaining and demonstrating the Rust-specific implementations of those features.

The book wasn't as detailed/flowery as https://eloquentjavascript.net/ (which is more 0-to-1 and could be read and understood by someone who's never coded before — I used it to originally learn to code in 2014). While it makes sense that some details were elided since this book is geared towards more experienced programmers, I would've liked to see more project-based chapters (Eloquent JavaScript has 5 projects over 21 chapters, whereas this book only has 3 over 20).

As an example: while reading, I did a personal project in Rust outside of the book, but I was Googling a lot of stuff and I'm not sure if my code was idiomatic/"good" Rust. It would have been nice to have more demonstrations of practical, idiomatic Rust code and project structure to solidify my understanding of how the language is used in practice. Good additional projects might include porting over the "A Programming Language" project from Eloquent Javascript to demonstrate Rust's higher-level features, and maybe another project that involved implementing some sort of low-level protocol or data structure to demonstrate Rust's systems-level features (the multithreaded web server project touched on this a little bit when we constructed raw HTML responses from byte strings).

In any case, Rust is a super cool language. I'm glad that the community has an official book like this to make it easy to get started learning and I'm looking forward to using Rust in future personal projects.

Profile Image for Adam Adair.
38 reviews1 follower
December 31, 2020
I heard good things about the Rust programming language, so I set about learning it. Rust has been voted the "most loved programming language" in the Stack Overflow Developer Survey every year since 2016. However, Rust is only 10 years old, so this fact seems suspicious. Dig a little deeper and you'll find out that despite developers' positive feelings toward Rust, 97% of them hadn't actually used it.

I have a personal system for learning programming languages, and it involves using a mix of books and online resources, and I started the same way for learning Rust. You quickly learn that this book is the "The Book" for Rust, and "Rust in Motion" is the go to online course for learning Rust. Dig a little deeper and you find out that there are not that many books on Rust, so the bar for being the best is kind of low. I came away disappointed in both the book and the course. Early in the book it became obvious that Rust is not a language that I am ever going to be able to use in my work, and it is an unusually difficult language to use. It would be hard for my opinion of Rust the language not to color my opinion of this book.

I didn't care for the approach of teaching the language through the use of compiler error messages, though this actually makes sense because programmers new to the language are going to get very familiar with compiler errors. I didn't care for the lazy approach the book took to teaching ways a function can take a parameter which is actually not formally described in words until chapter 13. Same with the concept of iterators which are the idiomatic methods of looping over a collections, but are not actually described until the same chapter 13. The chapter on concurrency is also rather poor.

I understand that this book is intended as an introduction to the language, and indeed this is perhaps the best book available for the purpose, but it doesn't stand up well against some of the other books I have used to learn other programming languages. But I have to give the three stars it deserves for getting me to the point of being able to use the language for more than trivial purposes.
8 reviews
October 16, 2021
I've heard good things about Rust and wanted to know what it is about. This book seemed like the Rust Book since it is available for free online and many people contributed to it through its GitHub Repo. I started reading online and switched to the paperback once I was convinced it is worth a read.

After reading it back to back (except the last chapter), I think I have a good understanding of what Rust offers. The book feels a bit like a reference, working through the features of Rust, but there are also chapters where small programs are written and explained step by step. Still, overall I feel like the author wanted to cover as much as possible, leaving many small aspects explained but without examples.

This makes it difficult to judge the book: Does it want to be a language reference or an introduction? Probably a bit of both, with a tendency to the former:

- If you're looking for a book to get started with Rust right away, I would suggest reading the first few chapters only and then gradually read on while you're practicing.
- If you're looking for a reference, this book is probably sufficient (although I can't tell how much hasn't been covered).

In comparison to the well-known K&R book, this book features fewer examples and details. Given that Rust is a much more complex language than C, I think it wouldn't have been possible to go as far into the details (e.g. I didn't find an operator precedence table) and provide as many examples. Otherwise, it would have been a massive book. But it does feel like they took some inspiration from K&R.

For me, the writing style was very understandable and that is also the book's biggest strength. It really really tries to get the reader to a point where he understands the concepts and doesn't slip into a snooty jargon-heavy style of writing as seen in other "language books". Only a very basic understanding of programming is required to get started, so it is beginner-friendly.

Of course, these are just my opinions. If you're unsure whether to start the book or not, just give it a try in the free online version.
Profile Image for Redowan Delowar.
42 reviews2 followers
July 1, 2021
I'm not a system programmer, but I went through the book to satiate my intellectual curiosity and to experience the ergonomics of developing in Rust. I live in the realm of backend development, data engineering, and data science and wanted to dip my toes into something that's a little lower level than Go.

After fiddling with the examples, and attempting to internalize a few concepts, it was apparent to me that Rust has a better toolchain compared to Go. The book perfectly lays out the concepts that are easily consumable for someone who is completely new to the Rust world, but has the experience of programming in other languages.

The book only explains the concepts that are new to Rust, and the data structure chapter assumes that you have the necessary knowledge of the fundamentals of data structures. It also doesn't dive too deep into Rust's internals.

Playing around with all the examples in the book helped me realize that although Rust has an incredible assortment of toolings, guaranteed memory safety, and bare-metal execution speed, development speed is pretty slow. The sheer expressiveness of the language is immensely helpful if you're doing system programming but can slow you down by a factor of N if you're trying to do backend development with it.

I highly recommend the book to anyone who wants to know how writing Rust feels like and whether it's the right tool for their job.
1 review
July 8, 2021
It has some good examples. Unfortunantly its exhaustivly written, where the author keeps reenforce exhaustive descriptions and redundancy like "in Listing-18-18" in stead of just saying "below" and other distracting nonsence that takes away from the over all comprehension. Basically it's an attempt to teach you like you are a very patient idiot, that enjoy being reminded of already established concepts. Keep in mind, these frases are in evry sentence, so it gets exhaustive quickly.

Its full of back-tracking-references where simply stating a variable name would be succicient. In stead of mentioning property x of y, it is full of jargon like "the x field of the Person struct wich is of type Person defined in mod stored in the non-borrowed mutable variable y in the main crate shown in listing 18-1.

Example: "Rather than encapsulating the states and transitions completely so outside code has no knowledge of them" The author should and can stop after "completely", but he rants on and not even adding appropriat comma, and this is just a simple and trivial example. The book is full of junk sentences that add more words without more meaning, and a well written version of this book would have consisted of just half of the 500 pages this auther impressivly managed to stratch this book into.

Other than that, it is helping you getting started with rust, just in a very inefficent and frustrating way, because of the authors poor communication skills.
Profile Image for Clara.
10 reviews10 followers
January 9, 2021
Dropped this around ch5 when life got way too hectic. Tried to pick it up again two moves later, but it's not as useful to me right now as books on C. It probably never will be, given the relative rates of adoption.

Even so, I hope to return to it. A lot of time is spent on explaining quirks of the language like ownership, which revolve around ensuring memory safety without garbage collection. While these concepts are explained clearly enough to approach as a dedicated beginner, this book is probably most useful to someone already comfortable with other system programming languages like C or C++.

The code examples in the online version illustrate the concepts well and run in the browser, but in most cases you'll have to run them on your own machine to see and interact with the best part of the language in my opinion: the delightfully verbose compiler messages you get when you have errors in your code. Fortunately, in addition to Rust By Example, there's a handy set of extra companion exercises that run in your terminal and a text editor of your choice:


There's also a git repository linked in the online version with a version you can build locally in a manner similar to gitbook, naturally using Rust.
87 reviews3 followers
July 7, 2022
The definitive intro resource for Rust lang. It's possible to export the online text to PDF and read on Kindle.

I think Rust has two killer features:
1. A Result type similar to Elm
2. Exhaustive match expressions

The Result type forces developers to handle errors unlike in Go where it’s possible to ignore the second return value in a function that returns foo, err

Compiler enforced exhaustive match expressions seem super helpful for ensuring that your code handles all possible scenarios, especially as new variants are added over time. It seems less than ideal to use conditional guards in match expressions because this invalides the compiler’s ability to perform exhaustive checking on the match expression. I hope there is a clippy warning that can inform you that you lose compiler help when using this feature.

Enums in Rust are more expressive than enums in Go because an enum variant can contain a value. I’m not entirely sure when to reach for a Rust struct vs enum yet.

I think the abbreviations baked into the language make it less welcoming to newcomers. Rhs (right hand side), dyn (dynamic), Rc (reference counter)…
Displaying 1 - 30 of 128 reviews

Can't find what you're looking for?

Get help and learn more about the design.