Skip to content

Segmenter cleanups, part 2 (reduce trait complexity) #6417

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

Merged
merged 10 commits into from
Apr 8, 2025

Conversation

Manishearth
Copy link
Member

@Manishearth Manishearth commented Apr 4, 2025

First set of followups after #6409

This:

  • Removes lifetimes and ?Sized from the BreakType traits
  • Coalesces the BreakType markers into a single set of RuleBreakTypeFoo markers
  • Makes LineBreakType depend on RuleBreakType
  • Adds a new WordBreakType that depends on RuleBreakType

previously the wordbreaktype distinction was awkwardly handled by unreachable!()s and trait impls; which meant it was not straightforward to make WordBreak use RuleBreakType instead of WordBreakType. Moving that required moving it to a function, but it seemed to work well.

This does not intend to finalize the module structure, it's still doing cleanups, I didn't wish to have these be blocked on module structure decisions.

A cleanup I may make is to use a secondary type parameter on RuleBReakIterator instead of a function pointer. It ought not matter, though.

@Manishearth Manishearth merged commit e4db884 into unicode-org:main Apr 8, 2025
29 checks passed
@Manishearth Manishearth deleted the segmenter-cleanups branch April 8, 2025 18:20
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