Learn how experienced Rust developers structure code using reusable patterns like builder or newtype.
Look up common Rust anti-patterns to avoid mistakes when designing APIs or managing ownership.
Read about Rust idioms to make your code feel natural and familiar to other Rust programmers.
Build the book locally with mdBook to browse it offline or contribute a new pattern.
This repository is the source for an open book called "Rust Design Patterns," which catalogs common approaches, recurring patterns, anti-patterns, and idioms used when writing code in the Rust programming language. The book is readable online for free and can also be downloaded as a PDF. The content is aimed at people who already know Rust basics and want to understand how experienced Rust developers think about structuring code. Design patterns are general, reusable solutions to problems that come up often in software development. Anti-patterns are approaches that seem reasonable but tend to cause problems. Idioms are the small habits and conventions that make code feel natural to other Rust programmers. Covering all three categories in one place gives readers a more complete picture of what good Rust code looks like beyond just getting the syntax right. The book is built using a tool called mdBook, which converts plain-text Markdown source files into a website or PDF. If you want to read or build the book locally, you install mdBook through Rust's package manager and run a single build command. The repository itself is not a software library you import into a project, it is purely a documentation and reference resource. Contributions are welcome. The project maintains an issue tracker that lists patterns and topics not yet covered, and there is a contribution guide explaining the process for adding or improving content. There is no specific institution or company maintaining this book, it is a community effort under the rust-unofficial GitHub organization. The content is licensed under the Mozilla Public License 2.0.
← rust-unofficial on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.