| 1 |
// This file is part of ICU4X. For terms of use, please see the file |
| 2 |
// called LICENSE at the top level of the ICU4X source tree |
| 3 |
// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). |
| 4 |
|
| 5 |
//! A provider for mapping Windows Zones to IANA identifiers. |
| 6 |
//! |
| 7 |
//! <div class="stab unstable"> |
| 8 |
//! 🚧 This code is considered unstable; it may change at any time, in breaking or non-breaking ways, |
| 9 |
//! including in SemVer minor releases. While the serde representation of data structs is guaranteed |
| 10 |
//! to be stable, their Rust representation might not be. Use with caution. |
| 11 |
//! </div> |
| 12 |
//! |
| 13 |
//! Read more about data providers: [`icu_provider`] |
| 14 |
|
| 15 |
use icu_provider::prelude::*; |
| 16 |
use zerotrie::ZeroTrieSimpleAscii; |
| 17 |
use zerovec::ZeroVec; |
| 18 |
|
| 19 |
use super::TimeZone; |
| 20 |
|
| 21 |
icu_provider::data_marker!( |
| 22 |
/// See [`WindowsZonesToBcp47Map`]. |
| 23 |
TimezoneIdentifiersWindowsV1, |
| 24 |
"timezone/identifiers/windows/v1", |
| 25 |
WindowsZonesToBcp47Map<'static>, |
| 26 |
is_singleton = true, |
| 27 |
); |
| 28 |
|
| 29 |
/// A mapping from Windows Timezone names to the corresponding BCP-47 IDs. |
| 30 |
/// |
| 31 |
/// <div class="stab unstable"> |
| 32 |
/// 🚧 This code is considered unstable; it may change at any time, in breaking or non-breaking ways, |
| 33 |
/// including in SemVer minor releases. While the serde representation of data structs is guaranteed |
| 34 |
/// to be stable, their Rust representation might not be. Use with caution. |
| 35 |
/// </div> |
| 36 |
#[derive(PartialEq, Debug, Clone, zerofrom::ZeroFrom, yoke::Yokeable)] |
| 37 |
#[cfg_attr(feature = "datagen", derive(serde::Serialize, databake::Bake))] |
| 38 |
#[cfg_attr(feature = "datagen", databake(path = icu_time::provider::windows))] |
| 39 |
#[cfg_attr(feature = "serde", derive(serde::Deserialize))] |
| 40 |
pub struct WindowsZonesToBcp47Map<'data> { |
| 41 |
/// A map from a `WindowsZoneIdentifier` and `WindowsRegion` to indexes of the associated BCP-47 time zone identifiers. |
| 42 |
#[cfg_attr(feature = "serde", serde(borrow))] |
| 43 |
pub map: ZeroTrieSimpleAscii<ZeroVec<'data, u8>>, |
| 44 |
|
| 45 |
/// A sorted list of BCP-47 time zone identifiers. |
| 46 |
#[cfg_attr(feature = "serde", serde(borrow))] |
| 47 |
pub bcp47_ids: ZeroVec<'data, TimeZone>, |
| 48 |
} |
| 49 |
|
| 50 |
icu_provider::data_struct!( |
| 51 |
WindowsZonesToBcp47Map<'_>, |
| 52 |
#[cfg(feature = "datagen")] |
| 53 |
); |