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

lending iterator

An iterator-like type whose items borrow from the iterator itself, so only one can be held at a time.

Defined with a GAT (type Item<'a> where Self: 'a; fn next<'a>(&'a mut self)); std has no such trait, so it's driven with while let.

Examples

  • With a lending ScanReader, let a = r.next(); let b = r.next(); fails with E0499 if a is still used, since each item borrows r mutably.

Read the full section →