✍️ Design patterns - Generic Associated Types Initiative (original) (raw)

Generic Associated Types Initiative

Design patterns

A natural question with GATs is to ask "what are they used for?" Because GATs represent a kind of "fundamental capability" of traits, though, that question can be difficult to answer in a short summary -- they can be used for all kinds of things! Therefore, this section attempts to answer by summarizing "design patterns" that we have seen in the wild that are enabled by GATs. These patterns are described through a "deep dive" into a particular example, often of a crate in the wild; but they represent patterns that could be extracted and applied in other cases.

List of projects using GATs

Over the years, many people have posted examples of how they would like to use GATs. compiler-errors compiled a mostly complete list which was posted to the stabilization issue. We reproduce that list here:

Projects using GATs

Blocked (at least in part) by GATs:

Other miscellaneous mentions of GATs, or GATs blocked a rewrite but workarounds were found

General themes for why folks want GATs

The general themes for why folks want GATs include...