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

opaque type

A return type the caller knows only by the traits it implements.

An opaque type (impl Trait in return position) is one concrete type chosen by the function and hidden from callers, who may use only the named traits.

Examples

  • fn evens() -> impl Iterator<Item = u32> { (0..10).filter(|n| n % 2 == 0) } hides the long Filter<..> type; callers can only use the result as an iterator.

Read the full section →