-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
DoubleEndedIterator and ExactSizeIterator for To*case. #38968
Conversation
r? @brson (rust_highfive has picked a reviewer for you, use r? to override) |
4d1f73d
to
4c6a6fc
Compare
4c6a6fc
to
1a402a5
Compare
Ping @brson |
I'm not sure that this is a guarantee we want to provide perhaps? Is there a motivation for this beyond just completeness? I could imagine future implementations, for example, that lazily compute future characters as opposed to buffering them all up in memory immediately as soon as the iterator is constructed. Implementing |
I will agree that shortly after I made this I thought that implementing DEI was a bit unnecessary, although I kept it in anyway. I'll remove that. ExactSizeIterator seems reasonable, though. |
Even that, though, do we get much benefit? It seems like it may preclude "interesting" future implementations maybe |
Initially my thought was that it could be used to help figure out more exact allocations for I guess that in principle, it makes sense to know how many characters are required for a lowercase form, but I'm also not sure if that's actually a strong desire. |
@brson may have more comments, but I think I personally have yet to be convinced (but certainly could be!) |
Ok we discussed this during libs triage today but the general sentiment was along the lines of what I've been saying previously which is that these are niche enough API use cases and without a concrete use case in mind we'd prefer to avoid restricting ourselves. If you've got a use case in mind for these though feel free to resubmit! |
Because the iterator itself is exact, I see no reason to not implement these traits. Sort of iffy in hindsight about
DoubleEndedIterator
but I've offered both to see what people think.