unicode-org / icu4x

Solving i18n for client-side and resource-constrained environments.
https://icu4x.unicode.org
Other
1.33k stars 174 forks source link

Refactor: Move `MeasureUnit` to a Separate Crate #5335

Open younies opened 1 month ago

younies commented 1 month ago

Task

Refactor the codebase by moving the MeasureUnit functionality into a dedicated crate.

Background

The MeasureUnit module is responsible for representing single or compound CLDR units (e.g., meter, square-meter, kilometer-per-second). This module is essential for various components, including unit formatting, unit conversion, and locale-aware unit representation.

To improve modularity and reusability across the project, it is necessary to isolate MeasureUnit into its own crate. This will facilitate better code organization and allow independent development and maintenance of unit-related functionalities.

younies commented 1 month ago

Related issue: https://github.com/unicode-org/icu4x/issues/5336

younies commented 1 month ago

A few ways we could split these crates:

  1. icu_units (core data types), icu_units_conversion (conversion)
  2. icu_units (conversion and re-exports), icu_units_core (core data types). Could be extended to also split out icu_units_conversion
  3. icu_foo (core data types) and icu_bar (conversion)
  4. icu_units (re-exports), icu_units_parser (core data types), icu_units_conversion (conversion)

Discussion:

Proposal:

LGTM: @younies @echeran @sffc

sffc commented 4 weeks ago

Based on the ballot, the winning crate name is: icu_units_core