Jump to ratings and reviews
Rate this book

Rust Brain Teasers: Exercise Your Mind

Rate this book
The Rust programming language is consistent and does its best to avoid surprising the programmer. Like all languages, though, Rust still has its quirks. But these quirks present a teaching opportunity. In this book, you'll work through a series of brain teasers that will challenge your understanding of Rust. By understanding the gaps in your knowledge, you can become better at what you do and avoid mistakes. Many of the teasers in this book come from the author's own experience creating software. Others derive from commonly asked questions in the Rust community. Regardless of their origin, these brain teasers are fun, and let's face who doesn't love a good puzzle, right?


What better way to exercise your brain and increase your Rust programming knowledge than with a collection of dynamic brain teasers? As you read through each of these puzzles and try to work out the answers, you'll not only learn about Rust's unique quirks and peculiarities, you'll also have loads of fun along the way.


Dive right in and get started with example code and sample problems that cover numbers and text, shadowing and memory, and everything in between. Try to figure out why a particular program won't compile, why it produces unexpected output, or why it panics and terminates with an error message. Once you've run the code and read the answer, it's time to get to the heart of the matter with a detailed explanation. Learn why a program produced the result it did, and discover how similar issues might affect the code you write in your own programs, even in production. Sourced from engaging discussions within the Rust community, real-world problems, and even reader feedback, these challenges will certainly surprise, enlighten, and entertain you.


Are you ready to experience Rust like never before? Then sharpen your brain and get ready for a challenge!


What You


This book assumes you have some knowledge of the Rust programming language. To work through the brain teasers in this book, you'll need a working Rust environment on any platform. You can install Rust by visiting You'll also need a text editor or Rust-friendly IDE.

139 pages, Kindle Edition

Published February 25, 2022

1 person is currently reading
28 people want to read

About the author

Herbert Wolverson

5 books10 followers
I was born in Surrey, England. My father brought home a BBC Micro, and I've been writing games ever since - first in BBC BASIC, then Pascal, C, C++ and a host of other languages. I've been releasing games and articles since the early 1990s. I also do consulting work and help maintain a Wireless Internet Service Provider in Missouri, USA.

After releasing The Rust Roguelike Tutorial, I started working with Pragmatic Publisher to release Hands-On Rust. It's currently in beta (the beta gets you updated ebooks as they are released, and you can go to devtalk to submit errata), with a final release expected in 2021.

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
0 (0%)
4 stars
13 (65%)
3 stars
5 (25%)
2 stars
1 (5%)
1 star
1 (5%)
Displaying 1 - 2 of 2 reviews
Profile Image for Sebastian Gebski.
1,219 reviews1,400 followers
February 13, 2023
I've found it a bit uninspired. When compared to previous "Brain Teasers" series books, I didn't find here many gotchas, surprises "under the hood", or new tricks that will enrich my play deck in the future. It doesn't mean that book ain't useful or that the author was lazy (actually - the writing style is very solid, and everything is well-documented and clear). So, maybe the issue is that Rust is so logical and rationally designed that there's not so much space for Brain Teasers? Hmm, I don't think it's the case TBH. The mind-bending concepts of lifecycles & borrowing make forcing the code to compile a non-trivial challenge for non-experts (like myself) :) That's why I think there's still an unfulfilled potential - this book could have been much better IMHO, but the author has chosen the newbie-friendliness over ruthless brain-slaughter of the innocent :D
Profile Image for David.
19 reviews4 followers
May 10, 2022
This is a quick and interesting read. It also contains links to external resources for additional details.
I've learned a few things about Rust in the process.
Displaying 1 - 2 of 2 reviews

Can't find what you're looking for?

Get help and learn more about the design.