Skip to content
Free public beta until December 4, 2026: every course is open, no card needed. After that, the first chapter of each course stays free and full access is a one-time $39 ($19 for up to 100 founding members chosen for helpful feedback). Your progress is kept. How the beta works

generic associated type

An associated type that takes its own type or lifetime parameters.

A GAT (type Item<'a> where Self: 'a) lets a trait's associated type depend on a lifetime or type chosen per use, as in lending iterators.

Examples

  • type Item<'a> where Self: 'a; lets a trait's item borrow from &'a mut self, which Iterator's plain type Item can't express.

Read the full section →