-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Implement last
for EscapeUnicode
#33103
Conversation
(rust_highfive has picked a reviewer for you, use r? to override) |
Thanks! Could you add a few tests for this as well? |
@ranma42 ping, in case you missed the original request by Alex (this happens to me way too often). |
Thanks for the heads-up! |
@alexcrichton ping-back ;) |
Implement `last` for `EscapeUnicode` The implementation is quite trivial as the last character is always `'{'`. As a side-effect it also improves the implementation of `last` for `EscapeUnicode`. Part of #24214, split from #31049. Maybe this (and the other changes that I will split from #31049) should wait for a test like `ed_iterator_specializations` to be added. Would it be sufficient to do the same for each possible escape length?
…richton Implement `count` for `EscapeUnicode` and cleanup the code for `count` for `EscapeDefault` (instead of repeating the `match` for `size_hint` and `count`). This PR marks EscapeUnicode and EscapeDefault as ExactSizeIterator. The constraints for the trait implementations held even before this PR, but I am not sure if this is something we want to guarantee/expose (I would love feedback on this, especially on what would be the appropriate way to handle stabilisation, if needed). Part of rust-lang#24214, split from rust-lang#31049. The test for `count` was added in rust-lang#33103.
The implementation is quite trivial as the last character is always
'{'
.As a side-effect it also improves the implementation of
last
forEscapeUnicode
.Part of #24214, split from #31049.
Maybe this (and the other changes that I will split from #31049) should wait for a test like
ed_iterator_specializations
to be added. Would it be sufficient to do the same for each possible escape length?