Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumRustassociated types vs genericsSingle-choice MCQ

Why is an associated type often preferred over a generic type parameter for a trait like `Iterator`?

trait Iterator { type Item; fn next(&mut self) -> Option<Self::Item>; } // vs. hypothetical: trait Iterator<Item> { ... }