Skip to content

Conversation

ryanavella
Copy link
Contributor

@ryanavella ryanavella commented Dec 24, 2023

I don't expect this to noticeably impact performance either positively or negatively for most use-cases, especially because Iterator::collect relies on the lower bound of size_hint which will remain unchanged after this PR.

However the upper bound will go from None to Some(upper), which may benefit downstream crates that use it as a heuristic for pre-allocation size.

Note also that I forwarded the implementation of size_hint to the inner iterator, which means it is UAX#29 agnostic. I'm not enough of a Unicode expert to know if e.g. word boundaries can be empty, so it may not be the tightest possible upper bound for longer strings.

@Manishearth Manishearth merged commit 062c264 into unicode-rs:master Dec 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants