Skip to content

Commit 48b04cb

Browse files
authored
CollationHanDatabase -> CollationRootHan (#6375)
Fixes #2784 <!-- Thank you for your pull request to ICU4X! Reminder: try to use [Conventional Comments](https://conventionalcomments.org/) to make comments clearer. Please see https://github.com/unicode-org/icu4x/blob/main/CONTRIBUTING.md for general information on contributing to ICU4X. -->
1 parent 4fe4658 commit 48b04cb

File tree

3 files changed

+21
-21
lines changed

3 files changed

+21
-21
lines changed

provider/icu4x-datagen/src/main.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,10 @@ struct Cli {
145145
#[cfg(feature = "provider")]
146146
trie_type: TrieType,
147147

148-
#[arg(long, value_enum, default_value_t = CollationHanDatabase::Implicit)]
148+
#[arg(long, value_enum, default_value_t = CollationRootHan::Implicit)]
149149
#[arg(help = "Which collation han database to use.")]
150150
#[cfg(feature = "provider")]
151-
collation_han_database: CollationHanDatabase,
151+
collation_root_han: CollationRootHan,
152152

153153
#[arg(long, value_enum, num_args = 1..)]
154154
#[arg(
@@ -237,8 +237,8 @@ enum TrieType {
237237
}
238238

239239
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, ValueEnum, Debug)]
240-
// Mirrors icu_provider_export::CollationHanDatabase
241-
enum CollationHanDatabase {
240+
// Mirrors icu_provider_export::CollationRootHan
241+
enum CollationRootHan {
242242
Unihan,
243243
Implicit,
244244
}
@@ -360,10 +360,10 @@ fn main() -> eyre::Result<()> {
360360
() => {
361361
let mut p = SourceDataProvider::new_custom();
362362

363-
p = p.with_collation_han_database(match cli.collation_han_database {
364-
CollationHanDatabase::Unihan => icu_provider_source::CollationHanDatabase::Unihan,
365-
CollationHanDatabase::Implicit => {
366-
icu_provider_source::CollationHanDatabase::Implicit
363+
p = p.with_collation_root_han(match cli.collation_root_han {
364+
CollationRootHan::Unihan => icu_provider_source::CollationRootHan::Unihan,
365+
CollationRootHan::Implicit => {
366+
icu_provider_source::CollationRootHan::Implicit
367367
}
368368
});
369369

provider/source/src/collator/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ impl SourceDataProvider {
105105
self.icuexport()?
106106
.read_and_parse_toml(&format!(
107107
"collation/{}/{}{}.toml",
108-
self.collation_han_database(),
108+
self.collation_root_han(),
109109
id_to_file_name(id),
110110
suffix
111111
))
@@ -120,7 +120,7 @@ impl SourceDataProvider {
120120
fn list_ids(&self, suffix: &str) -> Result<HashSet<DataIdentifierCow<'static>>, DataError> {
121121
Ok(self
122122
.icuexport()?
123-
.list(&format!("collation/{}", self.collation_han_database()))?
123+
.list(&format!("collation/{}", self.collation_root_han()))?
124124
.filter_map(|mut file_name| {
125125
file_name.truncate(file_name.len() - ".toml".len());
126126
file_name.ends_with(suffix).then(|| {

provider/source/src/lib.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ pub struct SourceDataProvider {
8181
segmenter_lstm_paths: Option<Arc<SerdeCache>>,
8282
tzdb_paths: Option<Arc<TzdbCache>>,
8383
trie_type: TrieType,
84-
collation_han_database: CollationHanDatabase,
84+
collation_root_han: CollationRootHan,
8585
pub(crate) timezone_horizon: Date<Iso>,
8686
#[allow(clippy::type_complexity)] // not as complex as it appears
8787
requests_cache: Arc<
@@ -155,7 +155,7 @@ impl SourceDataProvider {
155155
tzdb_paths: None,
156156
trie_type: Default::default(),
157157
timezone_horizon: Date::try_new_iso(2015, 1, 1).unwrap(),
158-
collation_han_database: Default::default(),
158+
collation_root_han: Default::default(),
159159
requests_cache: Default::default(),
160160
}
161161
}
@@ -340,10 +340,10 @@ impl SourceDataProvider {
340340
}
341341
}
342342

343-
/// Set the [`CollationHanDatabase`] version.
344-
pub fn with_collation_han_database(self, collation_han_database: CollationHanDatabase) -> Self {
343+
/// Set the [`CollationRootHan`] version.
344+
pub fn with_collation_root_han(self, collation_root_han: CollationRootHan) -> Self {
345345
Self {
346-
collation_han_database,
346+
collation_root_han,
347347
..self
348348
}
349349
}
@@ -366,8 +366,8 @@ impl SourceDataProvider {
366366
self.trie_type
367367
}
368368

369-
fn collation_han_database(&self) -> CollationHanDatabase {
370-
self.collation_han_database
369+
fn collation_root_han(&self) -> CollationRootHan {
370+
self.collation_root_han
371371
}
372372

373373
/// List the locales for the given CLDR coverage levels
@@ -476,7 +476,7 @@ where
476476
/// <https://github.com/unicode-org/icu/blob/main/docs/userguide/icu::data/buildtool.md#collation-ucadata>
477477
#[derive(Debug, Copy, Clone, PartialEq, Eq, Default, serde::Serialize, serde::Deserialize)]
478478
#[non_exhaustive]
479-
pub enum CollationHanDatabase {
479+
pub enum CollationRootHan {
480480
/// Implicit
481481
#[serde(rename = "implicit")]
482482
#[default]
@@ -486,11 +486,11 @@ pub enum CollationHanDatabase {
486486
Unihan,
487487
}
488488

489-
impl std::fmt::Display for CollationHanDatabase {
489+
impl std::fmt::Display for CollationRootHan {
490490
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> {
491491
match self {
492-
CollationHanDatabase::Implicit => write!(f, "implicithan"),
493-
CollationHanDatabase::Unihan => write!(f, "unihan"),
492+
CollationRootHan::Implicit => write!(f, "implicithan"),
493+
CollationRootHan::Unihan => write!(f, "unihan"),
494494
}
495495
}
496496
}

0 commit comments

Comments
 (0)