5 Design patterns: Beyond the basics
This chapter covers
- Metaprogramming with macros
- Implementing the builder pattern in Rust
- Building fluent interfaces
- Observing the observer pattern
- Understanding the command pattern
- Exploring the newtype pattern
Chapters 2 and 3 introduced the core Rust building blocks: generics, traits, pattern matching, and functional programming features. In this chapter, we’re going to build on what we learned in those chapters by exploring those themes further and examining design patterns in Rust.
Using what we’ve learned, we can start to build more concrete patterns in a way that is consistent with Rust idioms. Although we won’t explore all the possible patterns, I’ll present carefully chosen examples that demonstrate ...
Get Idiomatic Rust now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.