Skip to content

Commit

Permalink
Remove neo_serde (unicode-org#6101)
Browse files Browse the repository at this point in the history
  • Loading branch information
robertbastian authored Feb 12, 2025
1 parent 7697ae8 commit 9238422
Show file tree
Hide file tree
Showing 21 changed files with 219 additions and 889 deletions.
13 changes: 9 additions & 4 deletions components/datetime/benches/datetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
mod fixtures;

use criterion::{criterion_group, criterion_main, Criterion};
use icu_datetime::{fieldsets::enums::CompositeFieldSet, FixedCalendarDateTimeFormatter};
use icu_datetime::FixedCalendarDateTimeFormatter;

use icu_calendar::{Date, Gregorian};
use icu_locale_core::Locale;
Expand Down Expand Up @@ -48,13 +48,18 @@ fn datetime_benches(c: &mut Criterion) {
.collect();
for setup in &fx.setups {
let locale: Locale = setup.locale.parse().expect("Failed to parse locale.");
let skeleton =
CompositeFieldSet::try_from(setup.options.semantic.unwrap()).unwrap();
let fset = setup
.options
.semantic
.clone()
.unwrap()
.build_composite()
.unwrap();

let dtf = {
FixedCalendarDateTimeFormatter::<Gregorian, _>::try_new(
locale.into(),
skeleton,
fset,
)
.expect("Failed to create FixedCalendarDateTimeFormatter.")
};
Expand Down
4 changes: 2 additions & 2 deletions components/datetime/benches/fixtures/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// called LICENSE at the top level of the ICU4X source tree
// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ).

use icu_datetime::{fieldsets::serde::CompositeFieldSetSerde, provider::fields::components};
use icu_datetime::{fieldsets::builder::FieldSetBuilder, provider::fields::components};
use serde::{Deserialize, Serialize};

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
Expand All @@ -24,7 +24,7 @@ pub struct TestInput {
pub struct TestOptions {
pub length: Option<TestOptionsLength>,
pub components: Option<TestComponentsBag>,
pub semantic: Option<CompositeFieldSetSerde>,
pub semantic: Option<FieldSetBuilder>,
#[serde(rename = "hourCycle")]
pub hour_cycle: Option<TestHourCycle>,
}
Expand Down
65 changes: 26 additions & 39 deletions components/datetime/benches/fixtures/tests/components.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"year": "numeric"
},
"semantic": {
"fieldSet": ["year"],
"dateFields": "Y",
"length": "short"
}
}
Expand All @@ -21,7 +21,7 @@
"month": "numeric"
},
"semantic": {
"fieldSet": ["year", "month"],
"dateFields": "YM",
"length": "short"
}
}
Expand All @@ -35,7 +35,7 @@
"day": "numeric-day-of-month"
},
"semantic": {
"fieldSet": ["year", "month", "day"],
"dateFields": "YMD",
"length": "short"
}
}
Expand All @@ -50,7 +50,7 @@
"weekday": "short"
},
"semantic": {
"fieldSet": ["year", "month", "day", "weekday"],
"dateFields": "YMDE",
"length": "short"
}
}
Expand All @@ -63,7 +63,7 @@
"month": "short"
},
"semantic": {
"fieldSet": ["year", "month"],
"dateFields": "YM",
"length": "medium"
}
}
Expand All @@ -77,7 +77,7 @@
"day": "numeric-day-of-month"
},
"semantic": {
"fieldSet": ["year", "month", "day"],
"dateFields": "YMD",
"length": "medium"
}
}
Expand All @@ -92,7 +92,7 @@
"weekday": "short"
},
"semantic": {
"fieldSet": ["year", "month", "day", "weekday"],
"dateFields": "YMDE",
"length": "medium"
}
}
Expand All @@ -105,7 +105,7 @@
"month": "long"
},
"semantic": {
"fieldSet": ["year", "month"],
"dateFields": "YM",
"length": "long"
}
}
Expand All @@ -119,7 +119,7 @@
"day": "numeric-day-of-month"
},
"semantic": {
"fieldSet": ["year", "month", "day"],
"dateFields": "YMD",
"length": "long"
}
}
Expand All @@ -132,7 +132,7 @@
"day": "numeric-day-of-month"
},
"semantic": {
"fieldSet": ["month", "day"],
"dateFields": "MD",
"length": "short"
}
}
Expand All @@ -146,7 +146,7 @@
"weekday": "short"
},
"semantic": {
"fieldSet": ["month", "day", "weekday"],
"dateFields": "MDE",
"length": "short"
}
}
Expand All @@ -158,7 +158,7 @@
"month": "short"
},
"semantic": {
"fieldSet": ["month"],
"dateFields": "M",
"length": "medium"
}
}
Expand All @@ -171,7 +171,7 @@
"day": "numeric-day-of-month"
},
"semantic": {
"fieldSet": ["month", "day"],
"dateFields": "MD",
"length": "medium"
}
}
Expand All @@ -185,7 +185,7 @@
"weekday": "short"
},
"semantic": {
"fieldSet": ["month", "day", "weekday"],
"dateFields": "MDE",
"length": "medium"
}
}
Expand All @@ -198,7 +198,7 @@
"day": "numeric-day-of-month"
},
"semantic": {
"fieldSet": ["month", "day"],
"dateFields": "MD",
"length": "long"
}
}
Expand All @@ -210,7 +210,7 @@
"day": "numeric-day-of-month"
},
"semantic": {
"fieldSet": ["day"],
"dateFields": "D",
"length": "short"
}
}
Expand All @@ -223,7 +223,7 @@
"weekday": "short"
},
"semantic": {
"fieldSet": ["day", "weekday"],
"dateFields": "DE",
"length": "medium"
}
}
Expand All @@ -235,7 +235,7 @@
"weekday": "short"
},
"semantic": {
"fieldSet": ["weekday"],
"dateFields": "E",
"length": "medium"
}
}
Expand All @@ -249,7 +249,7 @@
"minute": "numeric"
},
"semantic": {
"fieldSet": ["weekday", "time"],
"dateFields": "E",
"length": "medium",
"timePrecision": "minute"
},
Expand All @@ -266,7 +266,7 @@
"second": "numeric"
},
"semantic": {
"fieldSet": ["weekday", "time"],
"dateFields": "E",
"length": "medium",
"timePrecision": "second"
},
Expand All @@ -282,7 +282,7 @@
"minute": "numeric"
},
"semantic": {
"fieldSet": ["weekday", "time"],
"dateFields": "E",
"length": "medium",
"timePrecision": "minute"
},
Expand All @@ -299,7 +299,7 @@
"second": "numeric"
},
"semantic": {
"fieldSet": ["weekday", "time"],
"dateFields": "E",
"length": "medium",
"timePrecision": "second"
},
Expand All @@ -313,7 +313,6 @@
"hour": "numeric"
},
"semantic": {
"fieldSet": ["time"],
"length": "medium",
"timePrecision": "hour"
},
Expand All @@ -328,7 +327,6 @@
"minute": "numeric"
},
"semantic": {
"fieldSet": ["time"],
"length": "medium",
"timePrecision": "minute"
},
Expand All @@ -344,7 +342,6 @@
"second": "numeric"
},
"semantic": {
"fieldSet": ["time"],
"length": "medium",
"timePrecision": "second"
},
Expand All @@ -358,7 +355,6 @@
"hour": "numeric"
},
"semantic": {
"fieldSet": ["time"],
"length": "medium",
"timePrecision": "hour"
},
Expand All @@ -373,7 +369,6 @@
"minute": "numeric"
},
"semantic": {
"fieldSet": ["time"],
"length": "medium",
"timePrecision": "minute"
},
Expand All @@ -389,7 +384,6 @@
"second": "numeric"
},
"semantic": {
"fieldSet": ["time"],
"length": "medium",
"timePrecision": "second"
},
Expand All @@ -404,7 +398,6 @@
"second": "numeric"
},
"semantic": {
"fieldSet": ["time"],
"length": "medium",
"timePrecision": "minute"
}
Expand All @@ -417,7 +410,7 @@
"year": "two-digit"
},
"semantic": {
"fieldSet": ["year"],
"dateFields": "Y",
"length": "short"
}
}
Expand All @@ -431,7 +424,7 @@
"day": "numeric-day-of-month"
},
"semantic": {
"fieldSet": ["year"],
"dateFields": "Y",
"length": "short",
"alignment": "column"
}
Expand All @@ -450,7 +443,7 @@
"minute": "numeric"
},
"semantic": {
"fieldSet": ["year", "month", "day", "weekday", "time"],
"dateFields": "YMDE",
"length": "medium",
"timePrecision": "minute"
},
Expand All @@ -470,7 +463,7 @@
"minute": "numeric"
},
"semantic": {
"fieldSet": ["year", "month", "day", "weekday", "time"],
"dateFields": "YMDE",
"length": "long",
"timePrecision": "minute"
},
Expand All @@ -485,7 +478,6 @@
"minute": "numeric"
},
"semantic": {
"fieldSet": ["time"],
"length": "short",
"timePrecision": "minute"
},
Expand All @@ -500,7 +492,6 @@
"minute": "numeric"
},
"semantic": {
"fieldSet": ["time"],
"length": "short",
"timePrecision": "minute"
},
Expand All @@ -515,7 +506,6 @@
"minute": "numeric"
},
"semantic": {
"fieldSet": ["time"],
"length": "short",
"timePrecision": "minute"
},
Expand All @@ -530,7 +520,6 @@
"minute": "numeric"
},
"semantic": {
"fieldSet": ["time"],
"length": "short",
"timePrecision": "minute"
},
Expand All @@ -545,7 +534,6 @@
"minute": "numeric"
},
"semantic": {
"fieldSet": ["time"],
"length": "short",
"timePrecision": "minute"
},
Expand All @@ -560,7 +548,6 @@
"minute": "numeric"
},
"semantic": {
"fieldSet": ["time"],
"length": "short",
"timePrecision": "minute"
},
Expand Down
Loading

0 comments on commit 9238422

Please sign in to comment.