Gat Lending Iterator
A library for lending iterators using Generic Associated Types (GATs). Work in progress.
What are Lending Iterators?
Lending iterators yield items that borrow from the iterator itself. Standard Rust iterators cannot do this—each item must be independent. Using Generic Associated Types (motivation), lending iterators enable efficient patterns like overlapping windows without cloning and iteration over mutable views.
Example
use ;
// Iterate over overlapping windows
let result: =
.windows
.map
.into_iter
.collect;
assert_eq!;
Features
Most Iterator methods work on LendingIterator, except those requiring multiple items simultaneously (e.g., collect, peekable). Some methods like map and cloned conditionally implement IntoIterator when the returned value doesn't borrow from input.
The crate includes a ToLendingIterator extension trait for converting standard iterators into lending iterators with methods like windows() and windows_mut().