rust_brain_teasers
rust_brain_teasers copied to clipboard
Source code to accompany the Rust Brain Teasers book.
Rust Brain Teasers
This repo contains source code from my second book, Rust Brain Teasers. Ever puzzle is included, as well as expanded versions for when a chapter includes a solution.
About Rust Brain Teasers
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 it: 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!
Where to Buy?
Rust Brain Teasers is available directly from the Pragmatic Programmers. You can buy it directly from the publisher, here.
PragProg primarily ship to the USA. In other parts of the world, you can use Amazon. I've tried to collate a few places from which you can buy Rust Brain Teasers:
- Rust Brain Teasers is on Amazon.com.
- Rust Brain Teasers is available at Barnes and Noble
- Waterstones
- WH Smith
- In Australia, you can order from Angus & Robertson
- Also in Australia, Booktopia
- Book People sell Rust Brain Teasers around the world.
You can also ask your local library or favorite independent bookstore for ISBN: 978-1680509175.
Source Code by Puzzle
- Three and a Bit
- Non-standard Input
- Type Conversion
- Byte-Sized Chunks
- How Long is a String?
- Please Reboot the Universe
- There and Back Again
- Walks Like a Duck, Quacks like a Duck
- Out of Order
- X Marks the Spot
- Stacking Boxes
- Amnesia
- Reverse the Polarity of the Neutron Flow
- Structure Sizing
- To Infinity
- Double or Nothing
- How Long is a Vector?
- Mutable Immutables
- Sleepless in Tokio
- Hello, Bonjour
- Tying a Gourdian Knot
- Waiting for Godot
- Constant Loops
- Home on the Range