Skip to main content
InterviewHubPRO
Section Overview
Q33

Question 33 of 50

Part 3: Advanced Internals, Scale & Production Patterns (Senior / Lead)

66%
Rust Systems & Tokio (50 Qs)•Part 3: Advanced Internals, Scale & Production Patterns (Senior / Lead)

What are GATs (Generic Associated Types)?

senior LevelCode ExampleTypeScript

In Simple Words: Allows associated types in traits to have their own generic or lifetime parameters:

rust
trait LendingIterator {
    type Item<'a> where Self: 'a;
    fn next<'a>(&'a mut self) -> Option<Self::Item<'a>>;
}
  • Enables streaming iterators that yield references to data owned by the iterator itself, a pattern previously impossible under standard Rust borrow rules!