Jump to ratings and reviews
Rate this book

Idiomatic Rust: Code like a Rustacean

Rate this book
Tips, tricks, design patterns, and secret features of Rust that will help you build stable and maintainable applications.

Whether you’re a Rust beginner or a pro, Idiomatic Rust will teach you to be a better Rust programmer. It introduces essential design patterns for Rust software with detailed explanations, and code samples that encourage you to get stuck in.

In Idiomatic Rust you’ll learn how to apply important design patterns

• Fluent interfaces for creating delightful APIs
• The Builder pattern to encapsulate data and perform initialization
• Immutable data structures that help you avoid hard-to-debug data race conditions
• Functional programming patterns
• Anti-patterns and what not to do in Rust

Idiomatic Rust catalogs, documents, and describes both how classic design patterns work with Rust, and the new Rust-specific patterns that will help you master the language. Each pattern or best practice helps solve common programming problems and ensure your code is easy for others to understand. You’ll learn when to use each pattern—and when to break it! You’ll soon be producing higher-quality Rust code and higher-quality Rust software.

About the technology

After you’re comfortable with Rust’s syntax and its uniquely-powerful compiler, there’s a whole new dimension to explore as you put it to use in real projects. How do you apply standard design patterns in Rust applications? Where and why should you use IntoIterator? Why do Rustaceans love the PhantomData type? This book answers these questions and many, many more.

About the book

Idiomatic Rust introduces the coding and design patterns you’ll need to take advantage of Rust’s unique language design. This book’s clear explanations and reusable code examples help you explore metaprogramming, build your own libraries, create fluent interfaces, and more. Along the way, you’ll learn how to write efficient, idiomatic Rust code that’s easy to maintain and evolve as you learn how the language works under the hood.

What's inside

• Creating delightful APIs
• Applying Builder and other classic design patterns
• Functional programming patterns
• Rust anti-patterns

About the reader

For intermediate Rust programmers.

About the author

Brenden Matthews is a member of the Apache Software Foundation, creator of the system monitor Conky, and author of Code Like a Pro in Rust.

The technical editor on this book was Alain M Couniot.

Table of Contents

PART 1
1 Rust-y patterns
2 Rust’s basic building blocks
3 Code flow
PART 2
4 Introductory patterns
5 Design Beyond the basics
6 Designing a library
PART 3
7 Using traits, generics, and structs for specialized tasks
8 State machines, coroutines, macros, and preludes
PART 4
9 Immutability
10 Antipatterns
A Installing Rust

442 pages, Kindle Edition

Published September 24, 2024

11 people are currently reading
33 people want to read

About the author

Brenden Matthews

3 books3 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
7 (28%)
4 stars
8 (32%)
3 stars
8 (32%)
2 stars
2 (8%)
1 star
0 (0%)
Displaying 1 - 3 of 3 reviews
Profile Image for Sebastian Gebski.
1,189 reviews1,341 followers
July 16, 2025
Really uneven ;/

Some chapters (like the one on using market traits in modelling the domain) are truly awesome - near-perfect and extremely useful. Some have a real potential - e.g., the one on using smart pointers (like Box, RC). Some could be developed in something truly useful (like the one on anti-patterns - which atm is nothing more than a proper check-list ...). But ... after reading the full book my main impressions are:
- it's chaotic
- there's not top-level idea on how to conduct the narration on idiomatic Rust here
- the initial part (30%-40%) is mostly a waste of time
- the structure is controversial - shouldn't the immutability part be an opening section of the book?
- some of sections sound like good ideas (coroutines, preludes) & I've indeed learned something new there, but ... they seem more like an idea for a blog post, than a full-blown book chapter

TBH, I'm a bit disappointed. But it doesn't mean I'm gonna smash the book without mercy - Rust is a new topic and every book focused on the idiomatic Rust is an interesting phenomenon. Anyway, it's hard to me to recommend this one easily ...
228 reviews5 followers
July 12, 2025
Freaking LinkedList
Displaying 1 - 3 of 3 reviews

Can't find what you're looking for?

Get help and learn more about the design.