-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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 nth
, count
, and last
for EscapeUnicode
#31049
Commits on Jan 20, 2016
-
Unify computation of length in
EscapeUnicode
The `offset` value was computed both in `next` and in `size_hint`; computing it in a single place ensures consistency and makes it easier to apply improvements. The value is now computed as soon as the iterator is constructed. This means that the time to compute it is spent immediately and cannot be avoided, but it also guarantees that it is only spent once.
Configuration menu - View commit details
-
Copy full SHA for 37a614e - Browse repository at this point
Copy the full SHA 37a614eView commit details -
Improve computation of
EscapeUnicode
offset fieldInstead of iteratively scanning the bits, use `leading_zeros`.
Configuration menu - View commit details
-
Copy full SHA for 1027e6a - Browse repository at this point
Copy the full SHA 1027e6aView commit details -
EscapeUnicode
andEscapeDefault
areExactSizeIterator
sIn rust-lang#28662, `size_hint` was made exact for `EscapeUnicode` and `EscapeDefault`, but neither was marked as `ExactSizeIterator`.
Configuration menu - View commit details
-
Copy full SHA for 7f5eae7 - Browse repository at this point
Copy the full SHA 7f5eae7View commit details -
Implement
count
forEscapeDefault
andEscapeUnicode
Trivial implementation, as both are `ExactSizeIterator`s. Part of rust-lang#24214.
Configuration menu - View commit details
-
Copy full SHA for 009e243 - Browse repository at this point
Copy the full SHA 009e243View commit details -
Configuration menu - View commit details
-
Copy full SHA for ad7f68d - Browse repository at this point
Copy the full SHA ad7f68dView commit details -
Move length computation to
ExactSizeIterator
implsand reuse it in `size_hint`.
Configuration menu - View commit details
-
Copy full SHA for 113b366 - Browse repository at this point
Copy the full SHA 113b366View commit details -
Extract stepping from
EscapeUnicode::next
Extract a function that updates the iterator state and returns the result of an arbitrary step of iteration. This implements the same logic as `next`, but it can be shared with `nth`.
Configuration menu - View commit details
-
Copy full SHA for f6c8757 - Browse repository at this point
Copy the full SHA f6c8757View commit details -
as a step from the appropriate state. Part of rust-lang#24214.
Configuration menu - View commit details
-
Copy full SHA for 23c5da0 - Browse repository at this point
Copy the full SHA 23c5da0View commit details -
Use the same structure for non-Unicode variants of
EscapeDefaultState
This makes it easier to have a unique path for handling all of them.
Configuration menu - View commit details
-
Copy full SHA for 90ddfc7 - Browse repository at this point
Copy the full SHA 90ddfc7View commit details -
Unify
EscapeDefault::next
andEscapeDefault::nth
by extracting a shared `step` function.
Configuration menu - View commit details
-
Copy full SHA for 266da8e - Browse repository at this point
Copy the full SHA 266da8eView commit details