rust-unofficial / patterns

A catalogue of Rust design patterns, anti-patterns and idioms
https://rust-unofficial.github.io/patterns/
Mozilla Public License 2.0
7.84k stars 352 forks source link

Umbrella: Repository Content (Scope)/ TODOs #116

Open simonsan opened 3 years ago

simonsan commented 3 years ago

Collection of design patterns and the corresponding issues if not contained in the repository already (in reference to Design patterns (by Gamma, Helm, Johnson, Vlissides)). Some patterns are probably not applicable to/realizable with Rust as they stem from OOP, but we'll sort that out on the way.

But in general I think it is also nice to have design patterns listed somewhere on a page that are not applicable to Rust and stated why and with an added workaround if any.

Checkmark = already existing in repository (link to file)
No checkmark = Link to corresponding issue
No checkmark and no link = Check if applicable for Rust

Coverage

Patterns

Creational Patterns

Structural Patterns

Behavioural Patterns

Still Uncategorized

Idioms

Anti-patterns

Functional Programming

Refactoring

General Unsorted

Notes

From Reddit

burdges commented 3 years ago

I donno if relevant but one can simulate a reasonable degree of simple local inheritance without overloading by using inherent methods on a parent types whose subtypes are specified using type parameters https://github.com/rust-lang/rfcs/issues/349#issuecomment-733204959 so generic methods on the polymorphic base become available to all children. In practice, one often needs sealed traits once this gets heavier, so then maybe a true trait interface makes sense, but sometimes the situation is quite simple.

simonsan commented 3 years ago

@simonsan Strategy pattern: https://medium.com/swlh/strategy-design-pattern-in-rust-5f5486cd294c I can add it here.

Nice, for sure! 💯

simonsan commented 3 years ago

Today I discovered https://github.com/udoprog/patterns where game engine patterns are collected and I was wondering if that might be a good idea to add these patterns in this repository. I opened an issue to discuss this and see what is the general stance on it over at udoprog/patterns: https://github.com/udoprog/patterns/issues/1

pickfire commented 3 years ago

Something new to addon for cell if anyone work on cell. https://plv.mpi-sws.org/rustbelt/ghostcell/