Skip to content

Commit 250a1ef

Browse files
authored
Rename data markers in icu_time crate (#6508)
1 parent 4261b4b commit 250a1ef

34 files changed

+598
-580
lines changed

components/time/src/provider/iana.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ pub const NON_REGION_CITY_PREFIX: u8 = b'_';
2929
icu_provider::data_marker!(
3030
/// See [`IanaToBcp47Map`]
3131
///
32-
/// This marker uses a checksum to ensure consistency with [`TimeZoneIanaNamesV1`].
33-
TimeZoneIanaMapV1,
34-
"time/zone/iana/map/v1",
32+
/// This marker uses a checksum to ensure consistency with [`TimezoneIdentifiersIanaExtendedV1`].
33+
TimezoneIdentifiersIanaCoreV1,
34+
"timezone/identifiers/iana/core/v1",
3535
IanaToBcp47Map<'static>,
3636
is_singleton = true,
3737
has_checksum = true,
@@ -40,9 +40,9 @@ icu_provider::data_marker!(
4040
icu_provider::data_marker!(
4141
/// See [`Bcp47ToIanaMap`]
4242
///
43-
/// This marker uses a checksum to ensure consistency with [`TimeZoneIanaMapV1`].
44-
TimeZoneIanaNamesV1,
45-
"time/zone/iana/names/v1",
43+
/// This marker uses a checksum to ensure consistency with [`TimezoneIdentifiersIanaCoreV1`].
44+
TimezoneIdentifiersIanaExtendedV1,
45+
"timezone/identifiers/iana/extended/v1",
4646
IanaNames<'static>,
4747
is_singleton = true,
4848
has_checksum = true,

components/time/src/provider/mod.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,19 +48,19 @@ const _: () = {
4848
pub use crate as time;
4949
}
5050
make_provider!(Baked);
51-
impl_time_zone_iana_map_v1!(Baked);
52-
impl_time_zone_iana_names_v1!(Baked);
53-
impl_time_zone_windows_v1!(Baked);
54-
impl_time_zone_offsets_v1!(Baked);
51+
impl_timezone_identifiers_iana_extended_v1!(Baked);
52+
impl_timezone_identifiers_iana_core_v1!(Baked);
53+
impl_timezone_identifiers_windows_v1!(Baked);
54+
impl_timezone_variants_offsets_v1!(Baked);
5555
};
5656

5757
#[cfg(feature = "datagen")]
5858
/// The latest minimum set of markers required by this component.
5959
pub const MARKERS: &[DataMarkerInfo] = &[
60-
iana::TimeZoneIanaNamesV1::INFO,
61-
iana::TimeZoneIanaMapV1::INFO,
62-
windows::TimeZoneWindowsV1::INFO,
63-
TimeZoneOffsetsV1::INFO,
60+
iana::TimezoneIdentifiersIanaExtendedV1::INFO,
61+
iana::TimezoneIdentifiersIanaCoreV1::INFO,
62+
windows::TimezoneIdentifiersWindowsV1::INFO,
63+
TimezoneVariantsOffsetsV1::INFO,
6464
];
6565

6666
/// Storage type for storing UTC offsets as eights of an hour.
@@ -163,8 +163,8 @@ icu_provider::data_marker!(
163163
///
164164
/// The values are the standard offset, and the daylight offset *relative to the standard offset*. As such,
165165
/// if the second value is 0, there is no daylight time.
166-
TimeZoneOffsetsV1,
167-
"time/zone/offsets/v1",
166+
TimezoneVariantsOffsetsV1,
167+
"timezone/variants/offsets/v1",
168168
ZeroMap2d<'static, TimeZone, MinutesSinceEpoch, (EighthsOfHourOffset, EighthsOfHourOffset)>,
169169
is_singleton = true
170170
);

components/time/src/provider/windows.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ use super::TimeZone;
2020

2121
icu_provider::data_marker!(
2222
/// See [`WindowsZonesToBcp47Map`].
23-
TimeZoneWindowsV1,
24-
"time/zone/windows/v1",
23+
TimezoneIdentifiersWindowsV1,
24+
"timezone/identifiers/windows/v1",
2525
WindowsZonesToBcp47Map<'static>,
2626
is_singleton = true,
2727
);

components/time/src/zone/iana.rs

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ use zerovec::vecs::{VarZeroSliceIter, ZeroSliceIter};
99

1010
use crate::{
1111
provider::iana::{
12-
IanaNames, IanaToBcp47Map, TimeZoneIanaMapV1, TimeZoneIanaNamesV1, NON_REGION_CITY_PREFIX,
12+
IanaNames, IanaToBcp47Map, TimezoneIdentifiersIanaCoreV1,
13+
TimezoneIdentifiersIanaExtendedV1, NON_REGION_CITY_PREFIX,
1314
},
1415
TimeZone,
1516
};
@@ -65,7 +66,7 @@ use crate::{
6566
/// ```
6667
#[derive(Debug, Clone)]
6768
pub struct IanaParser {
68-
data: DataPayload<TimeZoneIanaMapV1>,
69+
data: DataPayload<TimezoneIdentifiersIanaCoreV1>,
6970
checksum: u64,
7071
}
7172

@@ -95,14 +96,14 @@ impl IanaParser {
9596
#[doc = icu_provider::gen_buffer_unstable_docs!(UNSTABLE, Self::new)]
9697
pub fn try_new_unstable<P>(provider: &P) -> Result<Self, DataError>
9798
where
98-
P: DataProvider<TimeZoneIanaMapV1> + ?Sized,
99+
P: DataProvider<TimezoneIdentifiersIanaCoreV1> + ?Sized,
99100
{
100101
let response = provider.load(Default::default())?;
101102
Ok(Self {
102103
data: response.payload,
103104
checksum: response.metadata.checksum.ok_or_else(|| {
104105
DataError::custom("Missing checksum")
105-
.with_req(TimeZoneIanaMapV1::INFO, Default::default())
106+
.with_req(TimezoneIdentifiersIanaCoreV1::INFO, Default::default())
106107
})?,
107108
})
108109
}
@@ -151,8 +152,8 @@ impl IanaParserBorrowed<'static> {
151152
#[cfg(feature = "compiled_data")]
152153
pub fn new() -> Self {
153154
Self {
154-
data: crate::provider::Baked::SINGLETON_TIME_ZONE_IANA_MAP_V1,
155-
checksum: crate::provider::Baked::SINGLETON_TIME_ZONE_IANA_MAP_V1_CHECKSUM,
155+
data: crate::provider::Baked::SINGLETON_TIMEZONE_IDENTIFIERS_IANA_CORE_V1,
156+
checksum: crate::provider::Baked::SINGLETON_TIMEZONE_IDENTIFIERS_IANA_CORE_V1_CHECKSUM,
156157
}
157158
}
158159

@@ -258,7 +259,7 @@ impl Iterator for TimeZoneIter<'_> {
258259
#[derive(Debug, Clone)]
259260
pub struct IanaParserExtended<I> {
260261
inner: I,
261-
data: DataPayload<TimeZoneIanaNamesV1>,
262+
data: DataPayload<TimezoneIdentifiersIanaExtendedV1>,
262263
}
263264

264265
impl IanaParserExtended<IanaParser> {
@@ -287,7 +288,9 @@ impl IanaParserExtended<IanaParser> {
287288
#[doc = icu_provider::gen_buffer_unstable_docs!(UNSTABLE, Self::new)]
288289
pub fn try_new_unstable<P>(provider: &P) -> Result<Self, DataError>
289290
where
290-
P: DataProvider<TimeZoneIanaMapV1> + DataProvider<TimeZoneIanaNamesV1> + ?Sized,
291+
P: DataProvider<TimezoneIdentifiersIanaCoreV1>
292+
+ DataProvider<TimezoneIdentifiersIanaExtendedV1>
293+
+ ?Sized,
291294
{
292295
let parser = IanaParser::try_new_unstable(provider)?;
293296
Self::try_new_with_parser_unstable(provider, parser)
@@ -309,15 +312,17 @@ where
309312
#[cfg(feature = "compiled_data")]
310313
pub fn try_new_with_parser(parser: I) -> Result<Self, DataError> {
311314
if parser.as_ref().checksum
312-
!= crate::provider::Baked::SINGLETON_TIME_ZONE_IANA_NAMES_V1_CHECKSUM
315+
!= crate::provider::Baked::SINGLETON_TIMEZONE_IDENTIFIERS_IANA_EXTENDED_V1_CHECKSUM
313316
{
314-
return Err(DataErrorKind::InconsistentData(TimeZoneIanaMapV1::INFO)
315-
.with_marker(TimeZoneIanaNamesV1::INFO));
317+
return Err(
318+
DataErrorKind::InconsistentData(TimezoneIdentifiersIanaCoreV1::INFO)
319+
.with_marker(TimezoneIdentifiersIanaExtendedV1::INFO),
320+
);
316321
}
317322
Ok(Self {
318323
inner: parser,
319324
data: DataPayload::from_static_ref(
320-
crate::provider::Baked::SINGLETON_TIME_ZONE_IANA_NAMES_V1,
325+
crate::provider::Baked::SINGLETON_TIMEZONE_IDENTIFIERS_IANA_EXTENDED_V1,
321326
),
322327
})
323328
}
@@ -334,12 +339,16 @@ where
334339
#[doc = icu_provider::gen_buffer_unstable_docs!(UNSTABLE, Self::new)]
335340
pub fn try_new_with_parser_unstable<P>(provider: &P, parser: I) -> Result<Self, DataError>
336341
where
337-
P: DataProvider<TimeZoneIanaMapV1> + DataProvider<TimeZoneIanaNamesV1> + ?Sized,
342+
P: DataProvider<TimezoneIdentifiersIanaCoreV1>
343+
+ DataProvider<TimezoneIdentifiersIanaExtendedV1>
344+
+ ?Sized,
338345
{
339346
let response = provider.load(Default::default())?;
340347
if Some(parser.as_ref().checksum) != response.metadata.checksum {
341-
return Err(DataErrorKind::InconsistentData(TimeZoneIanaMapV1::INFO)
342-
.with_marker(TimeZoneIanaNamesV1::INFO));
348+
return Err(
349+
DataErrorKind::InconsistentData(TimezoneIdentifiersIanaCoreV1::INFO)
350+
.with_marker(TimezoneIdentifiersIanaExtendedV1::INFO),
351+
);
343352
}
344353
Ok(Self {
345354
inner: parser,
@@ -384,12 +393,12 @@ impl IanaParserExtendedBorrowed<'static> {
384393
#[cfg(feature = "compiled_data")]
385394
pub fn new() -> Self {
386395
const _: () = assert!(
387-
crate::provider::Baked::SINGLETON_TIME_ZONE_IANA_MAP_V1_CHECKSUM
388-
== crate::provider::Baked::SINGLETON_TIME_ZONE_IANA_NAMES_V1_CHECKSUM,
396+
crate::provider::Baked::SINGLETON_TIMEZONE_IDENTIFIERS_IANA_CORE_V1_CHECKSUM
397+
== crate::provider::Baked::SINGLETON_TIMEZONE_IDENTIFIERS_IANA_EXTENDED_V1_CHECKSUM,
389398
);
390399
Self {
391400
inner: IanaParserBorrowed::new(),
392-
data: crate::provider::Baked::SINGLETON_TIME_ZONE_IANA_NAMES_V1,
401+
data: crate::provider::Baked::SINGLETON_TIMEZONE_IDENTIFIERS_IANA_EXTENDED_V1,
393402
}
394403
}
395404

components/time/src/zone/offset.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
use core::str::FromStr;
66

7-
use crate::provider::{EighthsOfHourOffset, MinutesSinceEpoch, TimeZoneOffsetsV1};
7+
use crate::provider::{EighthsOfHourOffset, MinutesSinceEpoch, TimezoneVariantsOffsetsV1};
88
use crate::{Time, TimeZone};
99
use icu_calendar::Date;
1010
use icu_calendar::Iso;
@@ -197,7 +197,7 @@ impl FromStr for UtcOffset {
197197
/// [data provider]: icu_provider
198198
#[derive(Debug)]
199199
pub struct VariantOffsetsCalculator {
200-
pub(super) offset_period: DataPayload<TimeZoneOffsetsV1>,
200+
pub(super) offset_period: DataPayload<TimezoneVariantsOffsetsV1>,
201201
}
202202

203203
/// The borrowed version of a [`VariantOffsetsCalculator`]
@@ -225,7 +225,7 @@ impl VariantOffsetsCalculator {
225225
#[allow(clippy::new_ret_no_self)]
226226
pub const fn new() -> VariantOffsetsCalculatorBorrowed<'static> {
227227
VariantOffsetsCalculatorBorrowed {
228-
offset_period: crate::provider::Baked::SINGLETON_TIME_ZONE_OFFSETS_V1,
228+
offset_period: crate::provider::Baked::SINGLETON_TIMEZONE_VARIANTS_OFFSETS_V1,
229229
}
230230
}
231231

@@ -240,7 +240,7 @@ impl VariantOffsetsCalculator {
240240

241241
#[doc = icu_provider::gen_buffer_unstable_docs!(UNSTABLE, Self::new)]
242242
pub fn try_new_unstable(
243-
provider: &(impl DataProvider<TimeZoneOffsetsV1> + ?Sized),
243+
provider: &(impl DataProvider<TimezoneVariantsOffsetsV1> + ?Sized),
244244
) -> Result<Self, DataError> {
245245
let metazone_period = provider.load(Default::default())?.payload;
246246
Ok(Self {
@@ -268,7 +268,7 @@ impl VariantOffsetsCalculatorBorrowed<'static> {
268268
#[inline]
269269
pub const fn new() -> Self {
270270
Self {
271-
offset_period: crate::provider::Baked::SINGLETON_TIME_ZONE_OFFSETS_V1,
271+
offset_period: crate::provider::Baked::SINGLETON_TIMEZONE_VARIANTS_OFFSETS_V1,
272272
}
273273
}
274274

components/time/src/zone/windows.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use icu_locale_core::subtags::{region, Region};
99
use icu_provider::{DataError, DataPayload, DataProvider};
1010

1111
use crate::{
12-
provider::windows::{TimeZoneWindowsV1, WindowsZonesToBcp47Map},
12+
provider::windows::{TimezoneIdentifiersWindowsV1, WindowsZonesToBcp47Map},
1313
TimeZone,
1414
};
1515

@@ -35,7 +35,7 @@ use crate::{
3535
/// then the territory will default to the M.49 World Code, `001`.
3636
#[derive(Debug)]
3737
pub struct WindowsParser {
38-
data: DataPayload<TimeZoneWindowsV1>,
38+
data: DataPayload<TimezoneIdentifiersWindowsV1>,
3939
}
4040

4141
impl WindowsParser {
@@ -58,7 +58,7 @@ impl WindowsParser {
5858
#[doc = icu_provider::gen_buffer_unstable_docs!(UNSTABLE, Self::new)]
5959
pub fn try_new_unstable<P>(provider: &P) -> Result<Self, DataError>
6060
where
61-
P: DataProvider<TimeZoneWindowsV1> + ?Sized,
61+
P: DataProvider<TimezoneIdentifiersWindowsV1> + ?Sized,
6262
{
6363
let data = provider.load(Default::default())?.payload;
6464
Ok(Self { data })
@@ -106,7 +106,7 @@ impl WindowsParserBorrowed<'_> {
106106
#[cfg(feature = "compiled_data")]
107107
pub fn new() -> Self {
108108
WindowsParserBorrowed {
109-
data: crate::provider::Baked::SINGLETON_TIME_ZONE_WINDOWS_V1,
109+
data: crate::provider::Baked::SINGLETON_TIMEZONE_IDENTIFIERS_WINDOWS_V1,
110110
}
111111
}
112112

provider/data/time/data/mod.rs

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

provider/data/time/data/time_zone_iana_map_v1.rs.data

Lines changed: 0 additions & 77 deletions
This file was deleted.

0 commit comments

Comments
 (0)