This repository contains Rust 🦀 examples for all 23 classic GoF design patterns, and even a little more. It is developed to be a part of the Refactoring.Guru project.
Each example is designed to introduce a practical applicability in Rust, either it's a conceptual or a real world example. The Rust ideology and all the specifics are taken into account.
- For instance, some patterns are easy to implement with Rust, mostly creational ones, e.g. Prototype, Static Creation Method.
- The Mediator behavioral pattern is hardest to implement with Rust, considering Rust's specific ownership model with a strict borrow checker rules.
You can find README.md in each example with instructions and additional explanation.
These examples have been tested with a stable rustc 1.62 (2021 edition).
All examples can be launched via the command line, using cargo as follows:
cargo run --bin adapter This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
Authors: Alexander Fadeev (@fadeevab).
