-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Implement RandomAccessIterator where possible #8108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
One has to be careful with |
That's correct. Since the introduction of double-ended iterator, you can't be sure of the order the map function is invoked either (could be alternating front and back). I don't know how to best handle this. |
We could provide a separate adaptor that only takes an extern fn. That Map adaptor will be clonable and random access, and the standard one will not? In the end we don't have any purity guarantees either way. |
Not sure that such a restriction is worth it, either no functions or all functions (at least until we get an effects system); since there's no guarantee that extern fn's are idempotent/pure (e.g. |
Implement RandomAccessIterator (RAI) where possible, for Iterator adaptors such as Map, Enumerate, Peek, Skip, Take, Cycle, where the adapted iterator is already RAI, and for collections where it is relevant (ringbuf and bitv). After discussion with thestinger, remove the RAI impl for VecMutIterator, we cannot soundly provide mutable access with this trait. Implement Extendable everywhere FromIterator is already implemented. Fixes issue #8108.
Hasn't been fixed entirely, #8120 added a bunch of impls. |
"RAI" seems to never have reached usefulness. I'm still not sure if it should even be in rust. |
This ticket isn't particularly actionable, if anything is still missing, please open a new one with specifics, thanks. |
Adaptors like Enumerate, Map, Zip, Take etc need to implement Random access.
I'm working on this.
The text was updated successfully, but these errors were encountered: