README.md

March 2, 2020 · View on GitHub

Rust Design Patterns

Creational Patterns

PatternDescriptionStatus
Factory MethodDefers instantiation of an object to a specialized function for creating instances
Abstract FactoryProvides an interface for creating families of releated objects
BuilderBuilds a complex object using simple objects
SingletonRestricts instantiation of a type to one object

Behavioral Patterns

PatternDescriptionStatus
StrategyEnables an algorithm's behavior to be selected at runtime
StateEncapsulates varying behavior for the same object based on its internal state
CommandConverts requests or simple operations into objects.
IteratorLets you traverse elements of a collection without exposing its underlying representation
ObserverAllows one objects to notify other objects about changes in their state.
Chain of ResponsibilityAvoids coupling a sender to receiver by giving more than object a chance to handle the request

Structural Patterns

PatternDescriptionStatus
Adapterallows objects with incompatible interfaces to collaborate.
DecoratorAdds behavior to an object, statically or dynamically
ProxyProvides a surrogate for an object to control it's actions