add support for enumerate()
Closed this issue · 1 comments
tstack commented
Would it be possible to add support for enumerate()
? That's one of the things I miss from the standard iterators.
cuviper commented
I don't think it's possible, at least not in safe code, unless we switch entirely to GATs (generic associated types). Right now we return &Self::Item
, so enumerate would need to return something like &(usize, &Inner::Item)
, but there's no place to store that tuple with proper lifetimes and still hand back a reference to it. With GATs that would be more like type Item<'a> = (usize, Inner::Item<'a>);
and fn get(&self) -> Self::Item<'_>
.