diff --git a/components/datetime/src/time_zone.rs b/components/datetime/src/time_zone.rs index 95b5c6685ec..309b4dfd6d3 100644 --- a/components/datetime/src/time_zone.rs +++ b/components/datetime/src/time_zone.rs @@ -74,7 +74,7 @@ where /// /// ``` /// use icu::calendar::DateTime; -/// use icu::timezone::{CustomTimeZone, MetazoneCalculator}; +/// use icu::timezone::{CustomTimeZone, MetazoneCalculator, IanaToBcp47Mapper}; /// use icu::datetime::{DateTimeError, time_zone::TimeZoneFormatter}; /// use icu::locid::locale; /// use tinystr::tinystr; @@ -82,13 +82,15 @@ where /// /// // Set up the time zone. Note: the inputs here are /// // 1. The GMT offset -/// // 2. The BCP-47 time zone ID +/// // 2. The IANA time zone ID /// // 3. A datetime (for metazone resolution) /// // 4. Note: we do not need the zone variant because of `load_generic_*()` /// -/// // Set up the Metazone calculator and the DateTime to use in calculation +/// // Set up the Metazone calculator, time zone ID mapper, +/// // and the DateTime to use in calculation /// let mzc = MetazoneCalculator::try_new_unstable(&icu_testdata::unstable()) /// .unwrap(); +/// let mapper = IanaToBcp47Mapper::try_new_unstable(&icu_testdata::unstable()).unwrap(); /// let datetime = DateTime::try_new_iso_datetime(2022, 8, 29, 0, 0, 0) /// .unwrap(); /// @@ -104,7 +106,7 @@ where /// /// // "uschi" - has metazone symbol data for generic_non_location_short /// let mut time_zone = "-0600".parse::().unwrap(); -/// time_zone.time_zone_id = Some(tinystr!(8, "uschi").into()); +/// time_zone.time_zone_id = mapper.as_borrowed().get_strict("America/Chicago"); /// time_zone.maybe_calculate_metazone(&mzc, &datetime); /// assert_writeable_eq!( /// tzf.format(&time_zone), diff --git a/components/timezone/README.md b/components/timezone/README.md index b7fe62d57d7..7e86c4d8134 100644 --- a/components/timezone/README.md +++ b/components/timezone/README.md @@ -28,7 +28,8 @@ There are two mostly-interchangeable standards for time zone IDs: 1. IANA time zone IDs, like `"America/Chicago"` 2. BCP-47 time zone IDs, like `"uschi"` -ICU4X uses BCP-47 time zone IDs for all of its APIs. +ICU4X uses BCP-47 time zone IDs for all of its APIs. To get a BCP-47 time zone from an +IANA time zone, use [`IanaToBcp47Mapper`]. ### Metazone @@ -79,17 +80,18 @@ Create a time zone for which the offset and time zone ID are already known, and the metazone based on a certain local datetime: ```rust -use icu_calendar::DateTime; -use icu_timezone::CustomTimeZone; -use icu_timezone::GmtOffset; -use icu_timezone::MetazoneCalculator; +use icu::calendar::DateTime; +use icu::timezone::CustomTimeZone; +use icu::timezone::GmtOffset; +use icu::timezone::MetazoneCalculator; +use icu::timezone::IanaToBcp47Mapper; use tinystr::TinyAsciiStr; // Create a time zone for America/Chicago at GMT-6: let mut time_zone = CustomTimeZone::new_empty(); time_zone.gmt_offset = "-0600".parse::().ok(); -time_zone.time_zone_id = - "uschi".parse::>().ok().map(Into::into); +let mapper = IanaToBcp47Mapper::try_new_unstable(&icu_testdata::unstable()).unwrap(); +time_zone.time_zone_id = mapper.as_borrowed().get_strict("America/Chicago"); // Compute the metazone at January 1, 2022: let mzc = MetazoneCalculator::try_new_unstable(&icu_testdata::unstable()) diff --git a/components/timezone/src/iana_ids.rs b/components/timezone/src/iana_ids.rs new file mode 100644 index 00000000000..bb0fe3d4889 --- /dev/null +++ b/components/timezone/src/iana_ids.rs @@ -0,0 +1,174 @@ +// This file is part of ICU4X. For terms of use, please see the file +// called LICENSE at the top level of the ICU4X source tree +// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). + +use crate::error::TimeZoneError; +use crate::provider::names::*; +use crate::TimeZoneBcp47Id; +use icu_provider::prelude::*; + +/// A mapper from IANA time zone identifiers to BCP-47 time zone identifiers. +/// +/// # Examples +/// +/// Demonstration of usage with strict and loose lookup: +/// +/// ``` +/// use icu::timezone::IanaToBcp47Mapper; +/// +/// let mapper = IanaToBcp47Mapper::try_new_unstable(&icu_testdata::unstable()).unwrap(); +/// +/// // Strict: the IANA identifier is already in case-canonical form, and we find a match +/// let bcp47_id = mapper.as_borrowed().get_strict("America/Chicago"); +/// assert_eq!(bcp47_id, Some("uschi".parse().unwrap())); +/// +/// // Strict: the IANA identifier is not in the correct case, so we find no match +/// let bcp47_id = mapper.as_borrowed().get_strict("america/chicago"); +/// assert_eq!(bcp47_id, None); +/// +/// // Loose: we find the IANA identifier even though it is in the wrong case +/// let bcp47_id = mapper.as_borrowed().get_loose("america/chicago"); +/// assert_eq!(bcp47_id, Some("uschi".parse().unwrap())); +/// ``` +#[derive(Debug)] +pub struct IanaToBcp47Mapper { + data: DataPayload, +} + +impl IanaToBcp47Mapper { + /// Creates a new [`IanaToBcp47Mapper`]. + /// + /// See [`IanaToBcp47Mapper`] for an example. + /// + /// [📚 Help choosing a constructor](crate::constructors) + ///
+ /// ⚠️ The bounds on this function may change over time, including in SemVer minor releases. + ///
+ pub fn try_new_unstable

(provider: &P) -> Result + where + P: DataProvider + ?Sized, + { + let data = provider.load(Default::default())?.take_payload()?; + Ok(Self { data }) + } + + icu_provider::gen_any_buffer_constructors!(locale: skip, options: skip, error: TimeZoneError); + + /// Returns a borrowed version of the mapper that can be queried. + /// + /// This avoids a small potential cost of reading the data pointer. + pub fn as_borrowed(&self) -> IanaToBcp47MapperBorrowed { + IanaToBcp47MapperBorrowed { + data: self.data.get(), + } + } +} + +/// A borrowed wrapper around IANA-to-BCP47 time zone data, returned by +/// [`IanaToBcp47Mapper::as_borrowed()`]. More efficient to query. +#[derive(Debug)] +pub struct IanaToBcp47MapperBorrowed<'a> { + data: &'a IanaToBcp47MapV1<'a>, +} + +impl<'a> IanaToBcp47MapperBorrowed<'a> { + /// Looks up a BCP-47 time zone identifier based on an exact match for the given IANA + /// time zone identifier. + /// + /// See examples in [`IanaToBcp47Mapper`]. + pub fn get_strict(&self, iana_id: &str) -> Option { + self.data + .map + .get_copied(NormalizedTimeZoneIdStr::from_str(iana_id)) + } + + /// Looks up a BCP-47 time zone identifier based on an ASCII-case-insensitive match for + /// the given IANA time zone identifier. + /// + /// This is the type of match specified in [ECMAScript Temporal]. + /// + /// See examples in [`IanaToBcp47Mapper`]. + /// + /// [ECMAScript Temporal]: https://tc39.es/proposal-temporal/#sec-isavailabletimezonename + pub fn get_loose(&self, iana_id: &str) -> Option { + self.data + .map + .get_copied_by(|probe| probe.cmp_loose(NormalizedTimeZoneIdStr::from_str(iana_id))) + } +} + +/// A mapper from BCP-47 time zone identifiers to canonical IANA time zone identifiers. +/// +/// This is mainly useful if the IANA identifier needs to be recovered. However, the ID returned +/// from this function might not be the same as the one sourced from [`IanaToBcp47Mapper`]. +/// +/// # Examples +/// +/// Demonstration of canonicalization of the time zone identifier: +/// +/// ``` +/// use icu::timezone::IanaToBcp47Mapper; +/// use icu::timezone::Bcp47ToIanaMapper; +/// +/// let mapper1 = IanaToBcp47Mapper::try_new_unstable(&icu_testdata::unstable()).unwrap(); +/// let mapper2 = Bcp47ToIanaMapper::try_new_unstable(&icu_testdata::unstable()).unwrap(); +/// +/// // Look up the time zone ID for "Asia/Calcutta" +/// let bcp47_id = mapper1.as_borrowed().get_loose("asia/calcutta"); +/// assert_eq!(bcp47_id, Some("inccu".parse().unwrap())); +/// +/// // Get it back as the canonical form "Asia/Kolkata" +/// let mapper2_borrowed = mapper2.as_borrowed(); +/// let iana_id = mapper2_borrowed.get(bcp47_id.unwrap()); +/// assert_eq!(iana_id, Some("Asia/Kolkata")) +/// ``` +#[derive(Debug)] +pub struct Bcp47ToIanaMapper { + data: DataPayload, +} + +impl Bcp47ToIanaMapper { + /// Creates a new [`Bcp47ToIanaMapper`]. + /// + /// See [`Bcp47ToIanaMapper`] for an example. + /// + /// [📚 Help choosing a constructor](crate::constructors) + ///

+ /// ⚠️ The bounds on this function may change over time, including in SemVer minor releases. + ///
+ pub fn try_new_unstable

(provider: &P) -> Result + where + P: DataProvider + ?Sized, + { + let data = provider.load(Default::default())?.take_payload()?; + Ok(Self { data }) + } + + icu_provider::gen_any_buffer_constructors!(locale: skip, options: skip, error: TimeZoneError); + + /// Returns a borrowed version of the mapper that can be queried. + /// + /// This avoids a small potential cost of reading the data pointer. + pub fn as_borrowed(&self) -> Bcp47ToIanaMapperBorrowed { + Bcp47ToIanaMapperBorrowed { + data: self.data.get(), + } + } +} + +/// A borrowed wrapper around IANA-to-BCP47 time zone data, returned by +/// [`Bcp47ToIanaMapper::as_borrowed()`]. More efficient to query. +#[derive(Debug)] +pub struct Bcp47ToIanaMapperBorrowed<'a> { + data: &'a Bcp47ToIanaMapV1<'a>, +} + +impl<'a> Bcp47ToIanaMapperBorrowed<'a> { + /// Looks up a BCP-47 time zone identifier based on an exact match for the given IANA + /// time zone identifier. + /// + /// See examples in [`Bcp47ToIanaMapper`]. + pub fn get(&self, bcp47_id: TimeZoneBcp47Id) -> Option<&str> { + self.data.map.get(&bcp47_id.0.to_unvalidated()) + } +} diff --git a/components/timezone/src/lib.rs b/components/timezone/src/lib.rs index d5c02298e6d..03ca9b0f363 100644 --- a/components/timezone/src/lib.rs +++ b/components/timezone/src/lib.rs @@ -30,7 +30,8 @@ //! 1. IANA time zone IDs, like `"America/Chicago"` //! 2. BCP-47 time zone IDs, like `"uschi"` //! -//! ICU4X uses BCP-47 time zone IDs for all of its APIs. +//! ICU4X uses BCP-47 time zone IDs for all of its APIs. To get a BCP-47 time zone from an +//! IANA time zone, use [`IanaToBcp47Mapper`]. //! //! ## Metazone //! @@ -81,17 +82,18 @@ //! the metazone based on a certain local datetime: //! //! ``` -//! use icu_calendar::DateTime; -//! use icu_timezone::CustomTimeZone; -//! use icu_timezone::GmtOffset; -//! use icu_timezone::MetazoneCalculator; +//! use icu::calendar::DateTime; +//! use icu::timezone::CustomTimeZone; +//! use icu::timezone::GmtOffset; +//! use icu::timezone::MetazoneCalculator; +//! use icu::timezone::IanaToBcp47Mapper; //! use tinystr::TinyAsciiStr; //! //! // Create a time zone for America/Chicago at GMT-6: //! let mut time_zone = CustomTimeZone::new_empty(); //! time_zone.gmt_offset = "-0600".parse::().ok(); -//! time_zone.time_zone_id = -//! "uschi".parse::>().ok().map(Into::into); +//! let mapper = IanaToBcp47Mapper::try_new_unstable(&icu_testdata::unstable()).unwrap(); +//! time_zone.time_zone_id = mapper.as_borrowed().get_strict("America/Chicago"); //! //! // Compute the metazone at January 1, 2022: //! let mzc = MetazoneCalculator::try_new_unstable(&icu_testdata::unstable()) @@ -121,12 +123,14 @@ extern crate alloc; mod error; +mod iana_ids; mod metazone; pub mod provider; mod time_zone; mod types; pub use error::TimeZoneError; +pub use iana_ids::{Bcp47ToIanaMapper, IanaToBcp47Mapper}; pub use metazone::MetazoneCalculator; pub use provider::{MetazoneId, TimeZoneBcp47Id}; pub use time_zone::CustomTimeZone; diff --git a/components/timezone/src/provider.rs b/components/timezone/src/provider.rs index fdc82728c78..bd5efae96d6 100644 --- a/components/timezone/src/provider.rs +++ b/components/timezone/src/provider.rs @@ -21,6 +21,11 @@ use tinystr::TinyAsciiStr; use zerovec::ule::{AsULE, ULE}; use zerovec::{ZeroMap2d, ZeroSlice, ZeroVec}; +pub mod names; + +pub use names::Bcp47ToIanaMapV1Marker; +pub use names::IanaToBcp47MapV1Marker; + /// TimeZone ID in BCP47 format /// ///

diff --git a/components/timezone/src/provider/names.rs b/components/timezone/src/provider/names.rs new file mode 100644 index 00000000000..df8f128ecbf --- /dev/null +++ b/components/timezone/src/provider/names.rs @@ -0,0 +1,207 @@ +// This file is part of ICU4X. For terms of use, please see the file +// called LICENSE at the top level of the ICU4X source tree +// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). + +//! 🚧 \[Unstable\] Property names-related data for this component +//! +//!
+//! 🚧 This code is considered unstable; it may change at any time, in breaking or non-breaking ways, +//! including in SemVer minor releases. While the serde representation of data structs is guaranteed +//! to be stable, their Rust representation might not be. Use with caution. +//!
+//! +//! Read more about data providers: [`icu_provider`] + +use alloc::boxed::Box; +use core::cmp::Ordering; +use core::str; + +use icu_provider::prelude::*; + +use crate::TimeZoneBcp47Id; +use tinystr::UnvalidatedTinyAsciiStr; +use zerovec::ule::{UnvalidatedStr, VarULE}; +use zerovec::{maps::ZeroMapKV, VarZeroSlice, VarZeroVec, ZeroMap}; + +/// This is a time zone identifier that can be "loose matched" as according to +/// [ECMAScript Temporal](https://tc39.es/proposal-temporal/#sec-isavailabletimezonename) +/// +/// (matched case-insensitively in ASCII) +/// +/// This is expected to be ASCII, but we do not rely on this invariant anywhere except during +/// datagen. +/// +/// The Ord impl will sort things using strict equality, but in such a way that all loose-equal items +/// will sort into the same area, such that a map can be searched for both strict and loose equality. +/// +///
+/// 🚧 This code is considered unstable; it may change at any time, in breaking or non-breaking ways, +/// including in SemVer minor releases. While the serde representation of data structs is guaranteed +/// to be stable, their Rust representation might not be. Use with caution. +///
+/// +/// # Examples +/// +/// Using a [`NormalizedTimeZoneIdStr`] as the key of a [`ZeroMap`]: +/// +/// ``` +/// use icu_timezone::provider::names::NormalizedTimeZoneIdStr; +/// use zerovec::ZeroMap; +/// +/// let map: ZeroMap = [ +/// (NormalizedTimeZoneIdStr::from_str("America/Los_Angeles"), 11), +/// (NormalizedTimeZoneIdStr::from_str("Asia/Kolkata"), 22), +/// (NormalizedTimeZoneIdStr::from_str("Europe/Berlin"), 33), +/// ] +/// .into_iter() +/// .collect(); +/// +/// let key_approx = NormalizedTimeZoneIdStr::from_str("europe/berlin"); +/// let key_exact = NormalizedTimeZoneIdStr::from_str("Europe/Berlin"); +/// +/// // Strict lookup: +/// assert_eq!(None, map.get_copied(key_approx)); +/// assert_eq!(Some(33), map.get_copied(key_exact)); +/// +/// // Loose lookup: +/// assert_eq!(Some(33), map.get_copied_by(|u| u.cmp_loose(key_approx))); +/// assert_eq!(Some(33), map.get_copied_by(|u| u.cmp_loose(key_exact))); +/// ``` +#[derive(PartialEq, Eq)] // VarULE wants these to be byte equality +#[derive(Debug, VarULE)] +#[cfg_attr(feature = "serde", derive(serde::Serialize))] +#[repr(transparent)] +pub struct NormalizedTimeZoneIdStr(UnvalidatedStr); + +/// This impl requires enabling the optional `serde` Cargo feature of the `icu_properties` crate +#[cfg(feature = "serde")] +impl<'de> serde::Deserialize<'de> for Box { + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + >::deserialize(deserializer).map(NormalizedTimeZoneIdStr::cast_box) + } +} + +/// This impl requires enabling the optional `serde` Cargo feature of the `icu_properties` crate +#[cfg(feature = "serde")] +impl<'de, 'a> serde::Deserialize<'de> for &'a NormalizedTimeZoneIdStr +where + 'de: 'a, +{ + fn deserialize(deserializer: D) -> Result + where + D: serde::Deserializer<'de>, + { + <&UnvalidatedStr>::deserialize(deserializer).map(NormalizedTimeZoneIdStr::cast_ref) + } +} + +impl<'a> ZeroMapKV<'a> for NormalizedTimeZoneIdStr { + type Container = VarZeroVec<'a, NormalizedTimeZoneIdStr>; + type Slice = VarZeroSlice; + type GetType = NormalizedTimeZoneIdStr; + type OwnedType = Box; +} + +/// The Ord/PartialOrd impl will sort things using strict equality, but in such a way that all loose-equal items +/// will sort into the same area, such that a map can be searched for both strict and loose equality. +impl PartialOrd for NormalizedTimeZoneIdStr { + fn partial_cmp(&self, other: &Self) -> Option { + Some(self.cmp(other)) + } +} + +/// The Ord impl will sort things using strict equality, but in such a way that all loose-equal items +/// will sort into the same area, such that a map can be searched for both strict and loose equality. +impl Ord for NormalizedTimeZoneIdStr { + fn cmp(&self, other: &Self) -> Ordering { + let cmp = self.cmp_loose(other); + // When loose equality holds, fall back to strict equality + if cmp == Ordering::Equal { + self.0.cmp(&other.0) + } else { + cmp + } + } +} + +impl NormalizedTimeZoneIdStr { + /// Perform the loose comparison as defined in [`NormalizedTimeZoneIdStr`]. + pub fn cmp_loose(&self, other: &Self) -> Ordering { + let self_iter = self.0.iter().map(u8::to_ascii_lowercase); + let other_iter = other.0.iter().map(u8::to_ascii_lowercase); + self_iter.cmp(other_iter) + } + + /// Convert a string reference to a [`NormalizedTimeZoneIdStr`]. + pub const fn from_str(s: &str) -> &Self { + Self::cast_ref(UnvalidatedStr::from_str(s)) + } + + /// Convert a [`UnvalidatedStr`] reference to a [`NormalizedTimeZoneIdStr`] reference. + pub const fn cast_ref(value: &UnvalidatedStr) -> &Self { + // Safety: repr(transparent) + unsafe { core::mem::transmute(value) } + } + + /// Convert a [`UnvalidatedStr`] box to a [`NormalizedTimeZoneIdStr`] box. + pub const fn cast_box(value: Box) -> Box { + // Safety: repr(transparent) + unsafe { core::mem::transmute(value) } + } + + /// Get a [`NormalizedPropertyName`] box from a byte slice. + pub fn boxed_from_bytes(b: &[u8]) -> Box { + Self::cast_box(UnvalidatedStr::from_boxed_bytes(b.into())) + } +} + +/// A mapping from IANA time zone identifiers to BCP-47 time zone identifiers. +/// +/// Multiple IANA time zone IDs can map to the same BCP-47 time zone ID. +/// +///
+/// 🚧 This code is considered unstable; it may change at any time, in breaking or non-breaking ways, +/// including in SemVer minor releases. While the serde representation of data structs is guaranteed +/// to be stable, their Rust representation might not be. Use with caution. +///
+#[derive(Debug, Clone)] +#[icu_provider::data_struct(marker(IanaToBcp47MapV1Marker, "time_zone/iana_to_bcp47@1"))] +#[cfg_attr( + feature = "datagen", + derive(serde::Serialize, databake::Bake), + databake(path = icu_timezone::provider::names), +)] +#[cfg_attr(feature = "serde", derive(serde::Deserialize))] +#[yoke(prove_covariance_manually)] +pub struct IanaToBcp47MapV1<'data> { + /// A map from IANA time zone identifiers to BCP-47 time zone identifiers + #[cfg_attr(feature = "serde", serde(borrow))] + pub map: ZeroMap<'data, NormalizedTimeZoneIdStr, TimeZoneBcp47Id>, +} + +/// A mapping from IANA time zone identifiers to BCP-47 time zone identifiers. +/// +/// The BCP-47 time zone ID maps to the default IANA time zone ID according to the CLDR data. +/// +///
+/// 🚧 This code is considered unstable; it may change at any time, in breaking or non-breaking ways, +/// including in SemVer minor releases. While the serde representation of data structs is guaranteed +/// to be stable, their Rust representation might not be. Use with caution. +///
+#[derive(Debug, Clone)] +#[icu_provider::data_struct(marker(Bcp47ToIanaMapV1Marker, "time_zone/bcp47_to_iana@1"))] +#[cfg_attr( + feature = "datagen", + derive(serde::Serialize, databake::Bake), + databake(path = icu_timezone::provider::names), +)] +#[cfg_attr(feature = "serde", derive(serde::Deserialize))] +#[yoke(prove_covariance_manually)] +pub struct Bcp47ToIanaMapV1<'data> { + /// A map from BCP-47 time zone identifiers to IANA time zone identifiers + #[cfg_attr(feature = "serde", serde(borrow))] + pub map: ZeroMap<'data, UnvalidatedTinyAsciiStr<8>, str>, +} diff --git a/ffi/diplomat/c/include/ICU4XBcp47ToIanaMapper.h b/ffi/diplomat/c/include/ICU4XBcp47ToIanaMapper.h new file mode 100644 index 00000000000..483afe1ec29 --- /dev/null +++ b/ffi/diplomat/c/include/ICU4XBcp47ToIanaMapper.h @@ -0,0 +1,34 @@ +#ifndef ICU4XBcp47ToIanaMapper_H +#define ICU4XBcp47ToIanaMapper_H +#include +#include +#include +#include +#include "diplomat_runtime.h" + +#ifdef __cplusplus +namespace capi { +#endif + +typedef struct ICU4XBcp47ToIanaMapper ICU4XBcp47ToIanaMapper; +#ifdef __cplusplus +} // namespace capi +#endif +#include "ICU4XDataProvider.h" +#include "diplomat_result_box_ICU4XBcp47ToIanaMapper_ICU4XError.h" +#include "diplomat_result_void_ICU4XError.h" +#ifdef __cplusplus +namespace capi { +extern "C" { +#endif + +diplomat_result_box_ICU4XBcp47ToIanaMapper_ICU4XError ICU4XBcp47ToIanaMapper_create(const ICU4XDataProvider* provider); + +diplomat_result_void_ICU4XError ICU4XBcp47ToIanaMapper_get(const ICU4XBcp47ToIanaMapper* self, const char* value_data, size_t value_len, DiplomatWriteable* write); +void ICU4XBcp47ToIanaMapper_destroy(ICU4XBcp47ToIanaMapper* self); + +#ifdef __cplusplus +} // extern "C" +} // namespace capi +#endif +#endif diff --git a/ffi/diplomat/c/include/ICU4XCustomTimeZone.h b/ffi/diplomat/c/include/ICU4XCustomTimeZone.h index fe6181a1049..1531c02ee71 100644 --- a/ffi/diplomat/c/include/ICU4XCustomTimeZone.h +++ b/ffi/diplomat/c/include/ICU4XCustomTimeZone.h @@ -18,6 +18,7 @@ typedef struct ICU4XCustomTimeZone ICU4XCustomTimeZone; #include "diplomat_result_void_ICU4XError.h" #include "diplomat_result_int32_t_ICU4XError.h" #include "diplomat_result_bool_ICU4XError.h" +#include "ICU4XIanaToBcp47Mapper.h" #include "ICU4XMetazoneCalculator.h" #include "ICU4XIsoDateTime.h" #ifdef __cplusplus @@ -47,6 +48,10 @@ diplomat_result_bool_ICU4XError ICU4XCustomTimeZone_gmt_offset_has_seconds(const diplomat_result_void_ICU4XError ICU4XCustomTimeZone_try_set_time_zone_id(ICU4XCustomTimeZone* self, const char* id_data, size_t id_len); +diplomat_result_void_ICU4XError ICU4XCustomTimeZone_try_set_iana_time_zone_id_strict(ICU4XCustomTimeZone* self, const ICU4XIanaToBcp47Mapper* mapper, const char* id_data, size_t id_len); + +diplomat_result_void_ICU4XError ICU4XCustomTimeZone_try_set_iana_time_zone_id_loose(ICU4XCustomTimeZone* self, const ICU4XIanaToBcp47Mapper* mapper, const char* id_data, size_t id_len); + void ICU4XCustomTimeZone_clear_time_zone_id(ICU4XCustomTimeZone* self); diplomat_result_void_ICU4XError ICU4XCustomTimeZone_time_zone_id(const ICU4XCustomTimeZone* self, DiplomatWriteable* write); diff --git a/ffi/diplomat/c/include/ICU4XError.h b/ffi/diplomat/c/include/ICU4XError.h index 65e1c04a25c..8836275ac58 100644 --- a/ffi/diplomat/c/include/ICU4XError.h +++ b/ffi/diplomat/c/include/ICU4XError.h @@ -63,6 +63,7 @@ typedef enum ICU4XError { ICU4XError_TimeZoneOffsetOutOfBoundsError = 2560, ICU4XError_TimeZoneInvalidOffsetError = 2561, ICU4XError_TimeZoneMissingInputError = 2562, + ICU4XError_TimeZoneInvalidIdError = 2563, ICU4XError_NormalizerFutureExtensionError = 2816, ICU4XError_NormalizerValidationError = 2817, } ICU4XError; diff --git a/ffi/diplomat/c/include/ICU4XIanaToBcp47Mapper.h b/ffi/diplomat/c/include/ICU4XIanaToBcp47Mapper.h new file mode 100644 index 00000000000..e06433b6d0d --- /dev/null +++ b/ffi/diplomat/c/include/ICU4XIanaToBcp47Mapper.h @@ -0,0 +1,31 @@ +#ifndef ICU4XIanaToBcp47Mapper_H +#define ICU4XIanaToBcp47Mapper_H +#include +#include +#include +#include +#include "diplomat_runtime.h" + +#ifdef __cplusplus +namespace capi { +#endif + +typedef struct ICU4XIanaToBcp47Mapper ICU4XIanaToBcp47Mapper; +#ifdef __cplusplus +} // namespace capi +#endif +#include "ICU4XDataProvider.h" +#include "diplomat_result_box_ICU4XIanaToBcp47Mapper_ICU4XError.h" +#ifdef __cplusplus +namespace capi { +extern "C" { +#endif + +diplomat_result_box_ICU4XIanaToBcp47Mapper_ICU4XError ICU4XIanaToBcp47Mapper_create(const ICU4XDataProvider* provider); +void ICU4XIanaToBcp47Mapper_destroy(ICU4XIanaToBcp47Mapper* self); + +#ifdef __cplusplus +} // extern "C" +} // namespace capi +#endif +#endif diff --git a/ffi/diplomat/c/include/diplomat_result_box_ICU4XBcp47ToIanaMapper_ICU4XError.h b/ffi/diplomat/c/include/diplomat_result_box_ICU4XBcp47ToIanaMapper_ICU4XError.h new file mode 100644 index 00000000000..0d18fe40762 --- /dev/null +++ b/ffi/diplomat/c/include/diplomat_result_box_ICU4XBcp47ToIanaMapper_ICU4XError.h @@ -0,0 +1,26 @@ +#ifndef diplomat_result_box_ICU4XBcp47ToIanaMapper_ICU4XError_H +#define diplomat_result_box_ICU4XBcp47ToIanaMapper_ICU4XError_H +#include +#include +#include +#include +#include "diplomat_runtime.h" + +typedef struct ICU4XBcp47ToIanaMapper ICU4XBcp47ToIanaMapper; +#include "ICU4XError.h" +#ifdef __cplusplus +namespace capi { +extern "C" { +#endif +typedef struct diplomat_result_box_ICU4XBcp47ToIanaMapper_ICU4XError { + union { + ICU4XBcp47ToIanaMapper* ok; + ICU4XError err; + }; + bool is_ok; +} diplomat_result_box_ICU4XBcp47ToIanaMapper_ICU4XError; +#ifdef __cplusplus +} // extern "C" +} // namespace capi +#endif +#endif diff --git a/ffi/diplomat/c/include/diplomat_result_box_ICU4XIanaToBcp47Mapper_ICU4XError.h b/ffi/diplomat/c/include/diplomat_result_box_ICU4XIanaToBcp47Mapper_ICU4XError.h new file mode 100644 index 00000000000..2e05730b0ba --- /dev/null +++ b/ffi/diplomat/c/include/diplomat_result_box_ICU4XIanaToBcp47Mapper_ICU4XError.h @@ -0,0 +1,26 @@ +#ifndef diplomat_result_box_ICU4XIanaToBcp47Mapper_ICU4XError_H +#define diplomat_result_box_ICU4XIanaToBcp47Mapper_ICU4XError_H +#include +#include +#include +#include +#include "diplomat_runtime.h" + +typedef struct ICU4XIanaToBcp47Mapper ICU4XIanaToBcp47Mapper; +#include "ICU4XError.h" +#ifdef __cplusplus +namespace capi { +extern "C" { +#endif +typedef struct diplomat_result_box_ICU4XIanaToBcp47Mapper_ICU4XError { + union { + ICU4XIanaToBcp47Mapper* ok; + ICU4XError err; + }; + bool is_ok; +} diplomat_result_box_ICU4XIanaToBcp47Mapper_ICU4XError; +#ifdef __cplusplus +} // extern "C" +} // namespace capi +#endif +#endif diff --git a/ffi/diplomat/cpp/docs/source/errors_ffi.rst b/ffi/diplomat/cpp/docs/source/errors_ffi.rst index c32d6465584..04ff2d97e5e 100644 --- a/ffi/diplomat/cpp/docs/source/errors_ffi.rst +++ b/ffi/diplomat/cpp/docs/source/errors_ffi.rst @@ -129,6 +129,8 @@ .. cpp:enumerator:: TimeZoneMissingInputError + .. cpp:enumerator:: TimeZoneInvalidIdError + .. cpp:enumerator:: NormalizerFutureExtensionError .. cpp:enumerator:: NormalizerValidationError diff --git a/ffi/diplomat/cpp/docs/source/iana_bcp47_mapper_ffi.rst b/ffi/diplomat/cpp/docs/source/iana_bcp47_mapper_ffi.rst new file mode 100644 index 00000000000..c4468679b75 --- /dev/null +++ b/ffi/diplomat/cpp/docs/source/iana_bcp47_mapper_ffi.rst @@ -0,0 +1,42 @@ +``iana_bcp47_mapper::ffi`` +========================== + +.. cpp:class:: ICU4XBcp47ToIanaMapper + + An object capable of mapping from a BCP-47 time zone ID to an IANA ID. + + See the `Rust documentation for Bcp47ToIanaMapper `__ for more information. + + + .. cpp:function:: static diplomat::result create(const ICU4XDataProvider& provider) + + See the `Rust documentation for try_new_unstable `__ for more information. + + + .. cpp:function:: template diplomat::result get_to_writeable(const std::string_view value, W& write) const + + Writes out the canonical IANA time zone ID corresponding to the given BCP-47 ID. + + See the `Rust documentation for get `__ for more information. + + + .. cpp:function:: diplomat::result get(const std::string_view value) const + + Writes out the canonical IANA time zone ID corresponding to the given BCP-47 ID. + + See the `Rust documentation for get `__ for more information. + + +.. cpp:class:: ICU4XIanaToBcp47Mapper + + An object capable of mapping from an IANA time zone ID to a BCP-47 ID. + + This can be used via ``try_set_iana_time_zone_id_strict()`` on ```ICU4XCustomTimeZone`` `__. + + See the `Rust documentation for IanaToBcp47Mapper `__ for more information. + + + .. cpp:function:: static diplomat::result create(const ICU4XDataProvider& provider) + + See the `Rust documentation for try_new_unstable `__ for more information. + diff --git a/ffi/diplomat/cpp/docs/source/index.rst b/ffi/diplomat/cpp/docs/source/index.rst index 62844451e71..846aa76c8c8 100644 --- a/ffi/diplomat/cpp/docs/source/index.rst +++ b/ffi/diplomat/cpp/docs/source/index.rst @@ -18,6 +18,7 @@ Documentation errors_ffi fallbacker_ffi fixed_decimal_ffi + iana_bcp47_mapper_ffi list_ffi locale_ffi locid_transform_ffi diff --git a/ffi/diplomat/cpp/docs/source/timezone_ffi.rst b/ffi/diplomat/cpp/docs/source/timezone_ffi.rst index 380ad93ef5c..415edfe0943 100644 --- a/ffi/diplomat/cpp/docs/source/timezone_ffi.rst +++ b/ffi/diplomat/cpp/docs/source/timezone_ffi.rst @@ -105,6 +105,16 @@ Additional information: `1 `__ + .. cpp:function:: diplomat::result try_set_iana_time_zone_id_strict(const ICU4XIanaToBcp47Mapper& mapper, const std::string_view id) + + See the `Rust documentation for get_strict `__ for more information. + + + .. cpp:function:: diplomat::result try_set_iana_time_zone_id_loose(const ICU4XIanaToBcp47Mapper& mapper, const std::string_view id) + + See the `Rust documentation for get_loose `__ for more information. + + .. cpp:function:: void clear_time_zone_id() Clears the ``time_zone_id`` field. diff --git a/ffi/diplomat/cpp/examples/datetime/test.cpp b/ffi/diplomat/cpp/examples/datetime/test.cpp index 4aa2dbaf18f..753db6f3669 100644 --- a/ffi/diplomat/cpp/examples/datetime/test.cpp +++ b/ffi/diplomat/cpp/examples/datetime/test.cpp @@ -9,6 +9,8 @@ #include "../../include/ICU4XDataStruct.hpp" #include "../../include/ICU4XLogger.hpp" #include "../../include/ICU4XCustomTimeZone.hpp" +#include "../../include/ICU4XIanaToBcp47Mapper.hpp" +#include "../../include/ICU4XBcp47ToIanaMapper.hpp" #include "../../include/ICU4XGregorianZonedDateTimeFormatter.hpp" #include "../../include/ICU4XZonedDateTimeFormatter.hpp" @@ -66,10 +68,17 @@ int main() { return 1; } ICU4XMetazoneCalculator mzcalc = ICU4XMetazoneCalculator::create(dp).ok().value(); - time_zone.try_set_time_zone_id("uschi").ok().value(); + ICU4XIanaToBcp47Mapper mapper = ICU4XIanaToBcp47Mapper::create(dp).ok().value(); + time_zone.try_set_iana_time_zone_id_loose(mapper, "america/chicago").ok().value(); std::string time_zone_id_return = time_zone.time_zone_id().ok().value(); if (time_zone_id_return != "uschi") { - std::cout << "Time zone ID does not roundtrip" << std::endl; + std::cout << "Time zone ID does not roundtrip: " << time_zone_id_return << std::endl; + return 1; + } + ICU4XBcp47ToIanaMapper reverse_mapper = ICU4XBcp47ToIanaMapper::create(dp).ok().value(); + std::string recovered_iana_id = reverse_mapper.get("uschi").ok().value(); + if (recovered_iana_id != "US/Central") { + std::cout << "Time zone ID does not canonicalize to IANA: " << recovered_iana_id << std::endl; return 1; } ICU4XIsoDateTime local_datetime = ICU4XIsoDateTime::create(2022, 8, 25, 0, 0, 0, 0).ok().value(); diff --git a/ffi/diplomat/cpp/include/ICU4XBcp47ToIanaMapper.h b/ffi/diplomat/cpp/include/ICU4XBcp47ToIanaMapper.h new file mode 100644 index 00000000000..483afe1ec29 --- /dev/null +++ b/ffi/diplomat/cpp/include/ICU4XBcp47ToIanaMapper.h @@ -0,0 +1,34 @@ +#ifndef ICU4XBcp47ToIanaMapper_H +#define ICU4XBcp47ToIanaMapper_H +#include +#include +#include +#include +#include "diplomat_runtime.h" + +#ifdef __cplusplus +namespace capi { +#endif + +typedef struct ICU4XBcp47ToIanaMapper ICU4XBcp47ToIanaMapper; +#ifdef __cplusplus +} // namespace capi +#endif +#include "ICU4XDataProvider.h" +#include "diplomat_result_box_ICU4XBcp47ToIanaMapper_ICU4XError.h" +#include "diplomat_result_void_ICU4XError.h" +#ifdef __cplusplus +namespace capi { +extern "C" { +#endif + +diplomat_result_box_ICU4XBcp47ToIanaMapper_ICU4XError ICU4XBcp47ToIanaMapper_create(const ICU4XDataProvider* provider); + +diplomat_result_void_ICU4XError ICU4XBcp47ToIanaMapper_get(const ICU4XBcp47ToIanaMapper* self, const char* value_data, size_t value_len, DiplomatWriteable* write); +void ICU4XBcp47ToIanaMapper_destroy(ICU4XBcp47ToIanaMapper* self); + +#ifdef __cplusplus +} // extern "C" +} // namespace capi +#endif +#endif diff --git a/ffi/diplomat/cpp/include/ICU4XBcp47ToIanaMapper.hpp b/ffi/diplomat/cpp/include/ICU4XBcp47ToIanaMapper.hpp new file mode 100644 index 00000000000..87eb7d2a800 --- /dev/null +++ b/ffi/diplomat/cpp/include/ICU4XBcp47ToIanaMapper.hpp @@ -0,0 +1,100 @@ +#ifndef ICU4XBcp47ToIanaMapper_HPP +#define ICU4XBcp47ToIanaMapper_HPP +#include +#include +#include +#include +#include +#include +#include +#include "diplomat_runtime.hpp" + +#include "ICU4XBcp47ToIanaMapper.h" + +class ICU4XDataProvider; +class ICU4XBcp47ToIanaMapper; +#include "ICU4XError.hpp" + +/** + * A destruction policy for using ICU4XBcp47ToIanaMapper with std::unique_ptr. + */ +struct ICU4XBcp47ToIanaMapperDeleter { + void operator()(capi::ICU4XBcp47ToIanaMapper* l) const noexcept { + capi::ICU4XBcp47ToIanaMapper_destroy(l); + } +}; + +/** + * An object capable of mapping from a BCP-47 time zone ID to an IANA ID. + * + * See the [Rust documentation for `Bcp47ToIanaMapper`](https://docs.rs/icu/latest/icu/timezone/struct.Bcp47ToIanaMapper.html) for more information. + */ +class ICU4XBcp47ToIanaMapper { + public: + + /** + * + * + * See the [Rust documentation for `try_new_unstable`](https://docs.rs/icu/latest/icu/timezone/struct.Bcp47ToIanaMapper.html#method.try_new_unstable) for more information. + */ + static diplomat::result create(const ICU4XDataProvider& provider); + + /** + * Writes out the canonical IANA time zone ID corresponding to the given BCP-47 ID. + * + * See the [Rust documentation for `get`](https://docs.rs/icu/latest/icu/datetime/time_zone/struct.Bcp47ToIanaMapper.html#method.get) for more information. + */ + template diplomat::result get_to_writeable(const std::string_view value, W& write) const; + + /** + * Writes out the canonical IANA time zone ID corresponding to the given BCP-47 ID. + * + * See the [Rust documentation for `get`](https://docs.rs/icu/latest/icu/datetime/time_zone/struct.Bcp47ToIanaMapper.html#method.get) for more information. + */ + diplomat::result get(const std::string_view value) const; + inline const capi::ICU4XBcp47ToIanaMapper* AsFFI() const { return this->inner.get(); } + inline capi::ICU4XBcp47ToIanaMapper* AsFFIMut() { return this->inner.get(); } + inline ICU4XBcp47ToIanaMapper(capi::ICU4XBcp47ToIanaMapper* i) : inner(i) {} + ICU4XBcp47ToIanaMapper() = default; + ICU4XBcp47ToIanaMapper(ICU4XBcp47ToIanaMapper&&) noexcept = default; + ICU4XBcp47ToIanaMapper& operator=(ICU4XBcp47ToIanaMapper&& other) noexcept = default; + private: + std::unique_ptr inner; +}; + +#include "ICU4XDataProvider.hpp" + +inline diplomat::result ICU4XBcp47ToIanaMapper::create(const ICU4XDataProvider& provider) { + auto diplomat_result_raw_out_value = capi::ICU4XBcp47ToIanaMapper_create(provider.AsFFI()); + diplomat::result diplomat_result_out_value; + if (diplomat_result_raw_out_value.is_ok) { + diplomat_result_out_value = diplomat::Ok(std::move(ICU4XBcp47ToIanaMapper(diplomat_result_raw_out_value.ok))); + } else { + diplomat_result_out_value = diplomat::Err(std::move(static_cast(diplomat_result_raw_out_value.err))); + } + return diplomat_result_out_value; +} +template inline diplomat::result ICU4XBcp47ToIanaMapper::get_to_writeable(const std::string_view value, W& write) const { + capi::DiplomatWriteable write_writer = diplomat::WriteableTrait::Construct(write); + auto diplomat_result_raw_out_value = capi::ICU4XBcp47ToIanaMapper_get(this->inner.get(), value.data(), value.size(), &write_writer); + diplomat::result diplomat_result_out_value; + if (diplomat_result_raw_out_value.is_ok) { + diplomat_result_out_value = diplomat::Ok(std::monostate()); + } else { + diplomat_result_out_value = diplomat::Err(std::move(static_cast(diplomat_result_raw_out_value.err))); + } + return diplomat_result_out_value; +} +inline diplomat::result ICU4XBcp47ToIanaMapper::get(const std::string_view value) const { + std::string diplomat_writeable_string; + capi::DiplomatWriteable diplomat_writeable_out = diplomat::WriteableFromString(diplomat_writeable_string); + auto diplomat_result_raw_out_value = capi::ICU4XBcp47ToIanaMapper_get(this->inner.get(), value.data(), value.size(), &diplomat_writeable_out); + diplomat::result diplomat_result_out_value; + if (diplomat_result_raw_out_value.is_ok) { + diplomat_result_out_value = diplomat::Ok(std::monostate()); + } else { + diplomat_result_out_value = diplomat::Err(std::move(static_cast(diplomat_result_raw_out_value.err))); + } + return diplomat_result_out_value.replace_ok(std::move(diplomat_writeable_string)); +} +#endif diff --git a/ffi/diplomat/cpp/include/ICU4XCustomTimeZone.h b/ffi/diplomat/cpp/include/ICU4XCustomTimeZone.h index fe6181a1049..1531c02ee71 100644 --- a/ffi/diplomat/cpp/include/ICU4XCustomTimeZone.h +++ b/ffi/diplomat/cpp/include/ICU4XCustomTimeZone.h @@ -18,6 +18,7 @@ typedef struct ICU4XCustomTimeZone ICU4XCustomTimeZone; #include "diplomat_result_void_ICU4XError.h" #include "diplomat_result_int32_t_ICU4XError.h" #include "diplomat_result_bool_ICU4XError.h" +#include "ICU4XIanaToBcp47Mapper.h" #include "ICU4XMetazoneCalculator.h" #include "ICU4XIsoDateTime.h" #ifdef __cplusplus @@ -47,6 +48,10 @@ diplomat_result_bool_ICU4XError ICU4XCustomTimeZone_gmt_offset_has_seconds(const diplomat_result_void_ICU4XError ICU4XCustomTimeZone_try_set_time_zone_id(ICU4XCustomTimeZone* self, const char* id_data, size_t id_len); +diplomat_result_void_ICU4XError ICU4XCustomTimeZone_try_set_iana_time_zone_id_strict(ICU4XCustomTimeZone* self, const ICU4XIanaToBcp47Mapper* mapper, const char* id_data, size_t id_len); + +diplomat_result_void_ICU4XError ICU4XCustomTimeZone_try_set_iana_time_zone_id_loose(ICU4XCustomTimeZone* self, const ICU4XIanaToBcp47Mapper* mapper, const char* id_data, size_t id_len); + void ICU4XCustomTimeZone_clear_time_zone_id(ICU4XCustomTimeZone* self); diplomat_result_void_ICU4XError ICU4XCustomTimeZone_time_zone_id(const ICU4XCustomTimeZone* self, DiplomatWriteable* write); diff --git a/ffi/diplomat/cpp/include/ICU4XCustomTimeZone.hpp b/ffi/diplomat/cpp/include/ICU4XCustomTimeZone.hpp index fc1ccea36fd..a6ac4f58118 100644 --- a/ffi/diplomat/cpp/include/ICU4XCustomTimeZone.hpp +++ b/ffi/diplomat/cpp/include/ICU4XCustomTimeZone.hpp @@ -13,6 +13,7 @@ class ICU4XCustomTimeZone; #include "ICU4XError.hpp" +class ICU4XIanaToBcp47Mapper; class ICU4XMetazoneCalculator; class ICU4XIsoDateTime; @@ -132,6 +133,20 @@ class ICU4XCustomTimeZone { */ diplomat::result try_set_time_zone_id(const std::string_view id); + /** + * + * + * See the [Rust documentation for `get_strict`](https://docs.rs/icu/latest/icu/timezone/struct.IanaToBcp47MapperBorrowed.html#method.get_strict) for more information. + */ + diplomat::result try_set_iana_time_zone_id_strict(const ICU4XIanaToBcp47Mapper& mapper, const std::string_view id); + + /** + * + * + * See the [Rust documentation for `get_loose`](https://docs.rs/icu/latest/icu/timezone/struct.IanaToBcp47MapperBorrowed.html#method.get_loose) for more information. + */ + diplomat::result try_set_iana_time_zone_id_loose(const ICU4XIanaToBcp47Mapper& mapper, const std::string_view id); + /** * Clears the `time_zone_id` field. * @@ -305,6 +320,7 @@ class ICU4XCustomTimeZone { std::unique_ptr inner; }; +#include "ICU4XIanaToBcp47Mapper.hpp" #include "ICU4XMetazoneCalculator.hpp" #include "ICU4XIsoDateTime.hpp" @@ -397,6 +413,26 @@ inline diplomat::result ICU4XCustomTimeZone::try_set } return diplomat_result_out_value; } +inline diplomat::result ICU4XCustomTimeZone::try_set_iana_time_zone_id_strict(const ICU4XIanaToBcp47Mapper& mapper, const std::string_view id) { + auto diplomat_result_raw_out_value = capi::ICU4XCustomTimeZone_try_set_iana_time_zone_id_strict(this->inner.get(), mapper.AsFFI(), id.data(), id.size()); + diplomat::result diplomat_result_out_value; + if (diplomat_result_raw_out_value.is_ok) { + diplomat_result_out_value = diplomat::Ok(std::monostate()); + } else { + diplomat_result_out_value = diplomat::Err(std::move(static_cast(diplomat_result_raw_out_value.err))); + } + return diplomat_result_out_value; +} +inline diplomat::result ICU4XCustomTimeZone::try_set_iana_time_zone_id_loose(const ICU4XIanaToBcp47Mapper& mapper, const std::string_view id) { + auto diplomat_result_raw_out_value = capi::ICU4XCustomTimeZone_try_set_iana_time_zone_id_loose(this->inner.get(), mapper.AsFFI(), id.data(), id.size()); + diplomat::result diplomat_result_out_value; + if (diplomat_result_raw_out_value.is_ok) { + diplomat_result_out_value = diplomat::Ok(std::monostate()); + } else { + diplomat_result_out_value = diplomat::Err(std::move(static_cast(diplomat_result_raw_out_value.err))); + } + return diplomat_result_out_value; +} inline void ICU4XCustomTimeZone::clear_time_zone_id() { capi::ICU4XCustomTimeZone_clear_time_zone_id(this->inner.get()); } diff --git a/ffi/diplomat/cpp/include/ICU4XError.h b/ffi/diplomat/cpp/include/ICU4XError.h index 65e1c04a25c..8836275ac58 100644 --- a/ffi/diplomat/cpp/include/ICU4XError.h +++ b/ffi/diplomat/cpp/include/ICU4XError.h @@ -63,6 +63,7 @@ typedef enum ICU4XError { ICU4XError_TimeZoneOffsetOutOfBoundsError = 2560, ICU4XError_TimeZoneInvalidOffsetError = 2561, ICU4XError_TimeZoneMissingInputError = 2562, + ICU4XError_TimeZoneInvalidIdError = 2563, ICU4XError_NormalizerFutureExtensionError = 2816, ICU4XError_NormalizerValidationError = 2817, } ICU4XError; diff --git a/ffi/diplomat/cpp/include/ICU4XError.hpp b/ffi/diplomat/cpp/include/ICU4XError.hpp index 74f4ac9b957..8813f3f71eb 100644 --- a/ffi/diplomat/cpp/include/ICU4XError.hpp +++ b/ffi/diplomat/cpp/include/ICU4XError.hpp @@ -96,6 +96,7 @@ enum struct ICU4XError { TimeZoneOffsetOutOfBoundsError = 2560, TimeZoneInvalidOffsetError = 2561, TimeZoneMissingInputError = 2562, + TimeZoneInvalidIdError = 2563, NormalizerFutureExtensionError = 2816, NormalizerValidationError = 2817, }; diff --git a/ffi/diplomat/cpp/include/ICU4XIanaToBcp47Mapper.h b/ffi/diplomat/cpp/include/ICU4XIanaToBcp47Mapper.h new file mode 100644 index 00000000000..e06433b6d0d --- /dev/null +++ b/ffi/diplomat/cpp/include/ICU4XIanaToBcp47Mapper.h @@ -0,0 +1,31 @@ +#ifndef ICU4XIanaToBcp47Mapper_H +#define ICU4XIanaToBcp47Mapper_H +#include +#include +#include +#include +#include "diplomat_runtime.h" + +#ifdef __cplusplus +namespace capi { +#endif + +typedef struct ICU4XIanaToBcp47Mapper ICU4XIanaToBcp47Mapper; +#ifdef __cplusplus +} // namespace capi +#endif +#include "ICU4XDataProvider.h" +#include "diplomat_result_box_ICU4XIanaToBcp47Mapper_ICU4XError.h" +#ifdef __cplusplus +namespace capi { +extern "C" { +#endif + +diplomat_result_box_ICU4XIanaToBcp47Mapper_ICU4XError ICU4XIanaToBcp47Mapper_create(const ICU4XDataProvider* provider); +void ICU4XIanaToBcp47Mapper_destroy(ICU4XIanaToBcp47Mapper* self); + +#ifdef __cplusplus +} // extern "C" +} // namespace capi +#endif +#endif diff --git a/ffi/diplomat/cpp/include/ICU4XIanaToBcp47Mapper.hpp b/ffi/diplomat/cpp/include/ICU4XIanaToBcp47Mapper.hpp new file mode 100644 index 00000000000..3a5b52fdb41 --- /dev/null +++ b/ffi/diplomat/cpp/include/ICU4XIanaToBcp47Mapper.hpp @@ -0,0 +1,67 @@ +#ifndef ICU4XIanaToBcp47Mapper_HPP +#define ICU4XIanaToBcp47Mapper_HPP +#include +#include +#include +#include +#include +#include +#include +#include "diplomat_runtime.hpp" + +#include "ICU4XIanaToBcp47Mapper.h" + +class ICU4XDataProvider; +class ICU4XIanaToBcp47Mapper; +#include "ICU4XError.hpp" + +/** + * A destruction policy for using ICU4XIanaToBcp47Mapper with std::unique_ptr. + */ +struct ICU4XIanaToBcp47MapperDeleter { + void operator()(capi::ICU4XIanaToBcp47Mapper* l) const noexcept { + capi::ICU4XIanaToBcp47Mapper_destroy(l); + } +}; + +/** + * An object capable of mapping from an IANA time zone ID to a BCP-47 ID. + * + * This can be used via `try_set_iana_time_zone_id_strict()` on [`ICU4XCustomTimeZone`]. + * + * [`ICU4XCustomTimeZone`]: crate::timezone::ffi::ICU4XCustomTimeZone; + * + * See the [Rust documentation for `IanaToBcp47Mapper`](https://docs.rs/icu/latest/icu/timezone/struct.IanaToBcp47Mapper.html) for more information. + */ +class ICU4XIanaToBcp47Mapper { + public: + + /** + * + * + * See the [Rust documentation for `try_new_unstable`](https://docs.rs/icu/latest/icu/timezone/struct.IanaToBcp47Mapper.html#method.try_new_unstable) for more information. + */ + static diplomat::result create(const ICU4XDataProvider& provider); + inline const capi::ICU4XIanaToBcp47Mapper* AsFFI() const { return this->inner.get(); } + inline capi::ICU4XIanaToBcp47Mapper* AsFFIMut() { return this->inner.get(); } + inline ICU4XIanaToBcp47Mapper(capi::ICU4XIanaToBcp47Mapper* i) : inner(i) {} + ICU4XIanaToBcp47Mapper() = default; + ICU4XIanaToBcp47Mapper(ICU4XIanaToBcp47Mapper&&) noexcept = default; + ICU4XIanaToBcp47Mapper& operator=(ICU4XIanaToBcp47Mapper&& other) noexcept = default; + private: + std::unique_ptr inner; +}; + +#include "ICU4XDataProvider.hpp" + +inline diplomat::result ICU4XIanaToBcp47Mapper::create(const ICU4XDataProvider& provider) { + auto diplomat_result_raw_out_value = capi::ICU4XIanaToBcp47Mapper_create(provider.AsFFI()); + diplomat::result diplomat_result_out_value; + if (diplomat_result_raw_out_value.is_ok) { + diplomat_result_out_value = diplomat::Ok(std::move(ICU4XIanaToBcp47Mapper(diplomat_result_raw_out_value.ok))); + } else { + diplomat_result_out_value = diplomat::Err(std::move(static_cast(diplomat_result_raw_out_value.err))); + } + return diplomat_result_out_value; +} +#endif diff --git a/ffi/diplomat/cpp/include/diplomat_result_box_ICU4XBcp47ToIanaMapper_ICU4XError.h b/ffi/diplomat/cpp/include/diplomat_result_box_ICU4XBcp47ToIanaMapper_ICU4XError.h new file mode 100644 index 00000000000..0d18fe40762 --- /dev/null +++ b/ffi/diplomat/cpp/include/diplomat_result_box_ICU4XBcp47ToIanaMapper_ICU4XError.h @@ -0,0 +1,26 @@ +#ifndef diplomat_result_box_ICU4XBcp47ToIanaMapper_ICU4XError_H +#define diplomat_result_box_ICU4XBcp47ToIanaMapper_ICU4XError_H +#include +#include +#include +#include +#include "diplomat_runtime.h" + +typedef struct ICU4XBcp47ToIanaMapper ICU4XBcp47ToIanaMapper; +#include "ICU4XError.h" +#ifdef __cplusplus +namespace capi { +extern "C" { +#endif +typedef struct diplomat_result_box_ICU4XBcp47ToIanaMapper_ICU4XError { + union { + ICU4XBcp47ToIanaMapper* ok; + ICU4XError err; + }; + bool is_ok; +} diplomat_result_box_ICU4XBcp47ToIanaMapper_ICU4XError; +#ifdef __cplusplus +} // extern "C" +} // namespace capi +#endif +#endif diff --git a/ffi/diplomat/cpp/include/diplomat_result_box_ICU4XIanaToBcp47Mapper_ICU4XError.h b/ffi/diplomat/cpp/include/diplomat_result_box_ICU4XIanaToBcp47Mapper_ICU4XError.h new file mode 100644 index 00000000000..2e05730b0ba --- /dev/null +++ b/ffi/diplomat/cpp/include/diplomat_result_box_ICU4XIanaToBcp47Mapper_ICU4XError.h @@ -0,0 +1,26 @@ +#ifndef diplomat_result_box_ICU4XIanaToBcp47Mapper_ICU4XError_H +#define diplomat_result_box_ICU4XIanaToBcp47Mapper_ICU4XError_H +#include +#include +#include +#include +#include "diplomat_runtime.h" + +typedef struct ICU4XIanaToBcp47Mapper ICU4XIanaToBcp47Mapper; +#include "ICU4XError.h" +#ifdef __cplusplus +namespace capi { +extern "C" { +#endif +typedef struct diplomat_result_box_ICU4XIanaToBcp47Mapper_ICU4XError { + union { + ICU4XIanaToBcp47Mapper* ok; + ICU4XError err; + }; + bool is_ok; +} diplomat_result_box_ICU4XIanaToBcp47Mapper_ICU4XError; +#ifdef __cplusplus +} // extern "C" +} // namespace capi +#endif +#endif diff --git a/ffi/diplomat/js/docs/source/iana_bcp47_mapper_ffi.rst b/ffi/diplomat/js/docs/source/iana_bcp47_mapper_ffi.rst new file mode 100644 index 00000000000..66cb7bff773 --- /dev/null +++ b/ffi/diplomat/js/docs/source/iana_bcp47_mapper_ffi.rst @@ -0,0 +1,35 @@ +``iana_bcp47_mapper::ffi`` +========================== + +.. js:class:: ICU4XBcp47ToIanaMapper + + An object capable of mapping from a BCP-47 time zone ID to an IANA ID. + + See the `Rust documentation for Bcp47ToIanaMapper `__ for more information. + + + .. js:function:: create(provider) + + See the `Rust documentation for try_new_unstable `__ for more information. + + + .. js:method:: get(value) + + Writes out the canonical IANA time zone ID corresponding to the given BCP-47 ID. + + See the `Rust documentation for get `__ for more information. + + +.. js:class:: ICU4XIanaToBcp47Mapper + + An object capable of mapping from an IANA time zone ID to a BCP-47 ID. + + This can be used via ``try_set_iana_time_zone_id_strict()`` on ```ICU4XCustomTimeZone`` `__. + + See the `Rust documentation for IanaToBcp47Mapper `__ for more information. + + + .. js:function:: create(provider) + + See the `Rust documentation for try_new_unstable `__ for more information. + diff --git a/ffi/diplomat/js/docs/source/index.rst b/ffi/diplomat/js/docs/source/index.rst index 62844451e71..846aa76c8c8 100644 --- a/ffi/diplomat/js/docs/source/index.rst +++ b/ffi/diplomat/js/docs/source/index.rst @@ -18,6 +18,7 @@ Documentation errors_ffi fallbacker_ffi fixed_decimal_ffi + iana_bcp47_mapper_ffi list_ffi locale_ffi locid_transform_ffi diff --git a/ffi/diplomat/js/docs/source/timezone_ffi.rst b/ffi/diplomat/js/docs/source/timezone_ffi.rst index b2c67a0a9a2..29fcf0a5b19 100644 --- a/ffi/diplomat/js/docs/source/timezone_ffi.rst +++ b/ffi/diplomat/js/docs/source/timezone_ffi.rst @@ -105,6 +105,16 @@ Additional information: `1 `__ + .. js:method:: try_set_iana_time_zone_id_strict(mapper, id) + + See the `Rust documentation for get_strict `__ for more information. + + + .. js:method:: try_set_iana_time_zone_id_loose(mapper, id) + + See the `Rust documentation for get_loose `__ for more information. + + .. js:method:: clear_time_zone_id() Clears the ``time_zone_id`` field. diff --git a/ffi/diplomat/js/include/ICU4XBcp47ToIanaMapper.d.ts b/ffi/diplomat/js/include/ICU4XBcp47ToIanaMapper.d.ts new file mode 100644 index 00000000000..4bd84ef9073 --- /dev/null +++ b/ffi/diplomat/js/include/ICU4XBcp47ToIanaMapper.d.ts @@ -0,0 +1,28 @@ +import { FFIError } from "./diplomat-runtime" +import { ICU4XDataProvider } from "./ICU4XDataProvider"; +import { ICU4XError } from "./ICU4XError"; + +/** + + * An object capable of mapping from a BCP-47 time zone ID to an IANA ID. + + * See the {@link https://docs.rs/icu/latest/icu/timezone/struct.Bcp47ToIanaMapper.html Rust documentation for `Bcp47ToIanaMapper`} for more information. + */ +export class ICU4XBcp47ToIanaMapper { + + /** + + * See the {@link https://docs.rs/icu/latest/icu/timezone/struct.Bcp47ToIanaMapper.html#method.try_new_unstable Rust documentation for `try_new_unstable`} for more information. + * @throws {@link FFIError}<{@link ICU4XError}> + */ + static create(provider: ICU4XDataProvider): ICU4XBcp47ToIanaMapper | never; + + /** + + * Writes out the canonical IANA time zone ID corresponding to the given BCP-47 ID. + + * See the {@link https://docs.rs/icu/latest/icu/datetime/time_zone/struct.Bcp47ToIanaMapper.html#method.get Rust documentation for `get`} for more information. + * @throws {@link FFIError}<{@link ICU4XError}> + */ + get(value: string): string | never; +} diff --git a/ffi/diplomat/js/include/ICU4XBcp47ToIanaMapper.js b/ffi/diplomat/js/include/ICU4XBcp47ToIanaMapper.js new file mode 100644 index 00000000000..bca64227b96 --- /dev/null +++ b/ffi/diplomat/js/include/ICU4XBcp47ToIanaMapper.js @@ -0,0 +1,57 @@ +import wasm from "./diplomat-wasm.mjs" +import * as diplomatRuntime from "./diplomat-runtime.js" +import { ICU4XError_js_to_rust, ICU4XError_rust_to_js } from "./ICU4XError.js" + +const ICU4XBcp47ToIanaMapper_box_destroy_registry = new FinalizationRegistry(underlying => { + wasm.ICU4XBcp47ToIanaMapper_destroy(underlying); +}); + +export class ICU4XBcp47ToIanaMapper { + #lifetimeEdges = []; + constructor(underlying, owned, edges) { + this.underlying = underlying; + this.#lifetimeEdges.push(...edges); + if (owned) { + ICU4XBcp47ToIanaMapper_box_destroy_registry.register(this, underlying); + } + } + + static create(arg_provider) { + return (() => { + const diplomat_receive_buffer = wasm.diplomat_alloc(5, 4); + wasm.ICU4XBcp47ToIanaMapper_create(diplomat_receive_buffer, arg_provider.underlying); + const is_ok = diplomatRuntime.resultFlag(wasm, diplomat_receive_buffer, 4); + if (is_ok) { + const ok_value = new ICU4XBcp47ToIanaMapper(diplomatRuntime.ptrRead(wasm, diplomat_receive_buffer), true, []); + wasm.diplomat_free(diplomat_receive_buffer, 5, 4); + return ok_value; + } else { + const throw_value = ICU4XError_rust_to_js[diplomatRuntime.enumDiscriminant(wasm, diplomat_receive_buffer)]; + wasm.diplomat_free(diplomat_receive_buffer, 5, 4); + throw new diplomatRuntime.FFIError(throw_value); + } + })(); + } + + get(arg_value) { + const buf_arg_value = diplomatRuntime.DiplomatBuf.str(wasm, arg_value); + const diplomat_out = diplomatRuntime.withWriteable(wasm, (writeable) => { + return (() => { + const diplomat_receive_buffer = wasm.diplomat_alloc(5, 4); + wasm.ICU4XBcp47ToIanaMapper_get(diplomat_receive_buffer, this.underlying, buf_arg_value.ptr, buf_arg_value.size, writeable); + const is_ok = diplomatRuntime.resultFlag(wasm, diplomat_receive_buffer, 4); + if (is_ok) { + const ok_value = {}; + wasm.diplomat_free(diplomat_receive_buffer, 5, 4); + return ok_value; + } else { + const throw_value = ICU4XError_rust_to_js[diplomatRuntime.enumDiscriminant(wasm, diplomat_receive_buffer)]; + wasm.diplomat_free(diplomat_receive_buffer, 5, 4); + throw new diplomatRuntime.FFIError(throw_value); + } + })(); + }); + buf_arg_value.free(); + return diplomat_out; + } +} diff --git a/ffi/diplomat/js/include/ICU4XCustomTimeZone.d.ts b/ffi/diplomat/js/include/ICU4XCustomTimeZone.d.ts index a5f78f49ed8..24c77ab0c74 100644 --- a/ffi/diplomat/js/include/ICU4XCustomTimeZone.d.ts +++ b/ffi/diplomat/js/include/ICU4XCustomTimeZone.d.ts @@ -1,6 +1,7 @@ import { i32 } from "./diplomat-runtime" import { FFIError } from "./diplomat-runtime" import { ICU4XError } from "./ICU4XError"; +import { ICU4XIanaToBcp47Mapper } from "./ICU4XIanaToBcp47Mapper"; import { ICU4XIsoDateTime } from "./ICU4XIsoDateTime"; import { ICU4XMetazoneCalculator } from "./ICU4XMetazoneCalculator"; @@ -128,6 +129,20 @@ export class ICU4XCustomTimeZone { */ try_set_time_zone_id(id: string): void | never; + /** + + * See the {@link https://docs.rs/icu/latest/icu/timezone/struct.IanaToBcp47MapperBorrowed.html#method.get_strict Rust documentation for `get_strict`} for more information. + * @throws {@link FFIError}<{@link ICU4XError}> + */ + try_set_iana_time_zone_id_strict(mapper: ICU4XIanaToBcp47Mapper, id: string): void | never; + + /** + + * See the {@link https://docs.rs/icu/latest/icu/timezone/struct.IanaToBcp47MapperBorrowed.html#method.get_loose Rust documentation for `get_loose`} for more information. + * @throws {@link FFIError}<{@link ICU4XError}> + */ + try_set_iana_time_zone_id_loose(mapper: ICU4XIanaToBcp47Mapper, id: string): void | never; + /** * Clears the `time_zone_id` field. diff --git a/ffi/diplomat/js/include/ICU4XCustomTimeZone.js b/ffi/diplomat/js/include/ICU4XCustomTimeZone.js index 5e0b3ab6c87..3c63f4d59fb 100644 --- a/ffi/diplomat/js/include/ICU4XCustomTimeZone.js +++ b/ffi/diplomat/js/include/ICU4XCustomTimeZone.js @@ -170,6 +170,46 @@ export class ICU4XCustomTimeZone { return diplomat_out; } + try_set_iana_time_zone_id_strict(arg_mapper, arg_id) { + const buf_arg_id = diplomatRuntime.DiplomatBuf.str(wasm, arg_id); + const diplomat_out = (() => { + const diplomat_receive_buffer = wasm.diplomat_alloc(5, 4); + wasm.ICU4XCustomTimeZone_try_set_iana_time_zone_id_strict(diplomat_receive_buffer, this.underlying, arg_mapper.underlying, buf_arg_id.ptr, buf_arg_id.size); + const is_ok = diplomatRuntime.resultFlag(wasm, diplomat_receive_buffer, 4); + if (is_ok) { + const ok_value = {}; + wasm.diplomat_free(diplomat_receive_buffer, 5, 4); + return ok_value; + } else { + const throw_value = ICU4XError_rust_to_js[diplomatRuntime.enumDiscriminant(wasm, diplomat_receive_buffer)]; + wasm.diplomat_free(diplomat_receive_buffer, 5, 4); + throw new diplomatRuntime.FFIError(throw_value); + } + })(); + buf_arg_id.free(); + return diplomat_out; + } + + try_set_iana_time_zone_id_loose(arg_mapper, arg_id) { + const buf_arg_id = diplomatRuntime.DiplomatBuf.str(wasm, arg_id); + const diplomat_out = (() => { + const diplomat_receive_buffer = wasm.diplomat_alloc(5, 4); + wasm.ICU4XCustomTimeZone_try_set_iana_time_zone_id_loose(diplomat_receive_buffer, this.underlying, arg_mapper.underlying, buf_arg_id.ptr, buf_arg_id.size); + const is_ok = diplomatRuntime.resultFlag(wasm, diplomat_receive_buffer, 4); + if (is_ok) { + const ok_value = {}; + wasm.diplomat_free(diplomat_receive_buffer, 5, 4); + return ok_value; + } else { + const throw_value = ICU4XError_rust_to_js[diplomatRuntime.enumDiscriminant(wasm, diplomat_receive_buffer)]; + wasm.diplomat_free(diplomat_receive_buffer, 5, 4); + throw new diplomatRuntime.FFIError(throw_value); + } + })(); + buf_arg_id.free(); + return diplomat_out; + } + clear_time_zone_id() { wasm.ICU4XCustomTimeZone_clear_time_zone_id(this.underlying); } diff --git a/ffi/diplomat/js/include/ICU4XError.d.ts b/ffi/diplomat/js/include/ICU4XError.d.ts index ef00127f366..82f7fbc56f3 100644 --- a/ffi/diplomat/js/include/ICU4XError.d.ts +++ b/ffi/diplomat/js/include/ICU4XError.d.ts @@ -174,6 +174,9 @@ export enum ICU4XError { /** */ TimeZoneMissingInputError = 'TimeZoneMissingInputError', + /** + */ + TimeZoneInvalidIdError = 'TimeZoneInvalidIdError', /** */ NormalizerFutureExtensionError = 'NormalizerFutureExtensionError', diff --git a/ffi/diplomat/js/include/ICU4XError.js b/ffi/diplomat/js/include/ICU4XError.js index d64c46208f6..af576023100 100644 --- a/ffi/diplomat/js/include/ICU4XError.js +++ b/ffi/diplomat/js/include/ICU4XError.js @@ -54,6 +54,7 @@ export const ICU4XError_js_to_rust = { "TimeZoneOffsetOutOfBoundsError": 2560, "TimeZoneInvalidOffsetError": 2561, "TimeZoneMissingInputError": 2562, + "TimeZoneInvalidIdError": 2563, "NormalizerFutureExtensionError": 2816, "NormalizerValidationError": 2817, }; @@ -111,6 +112,7 @@ export const ICU4XError_rust_to_js = { [2560]: "TimeZoneOffsetOutOfBoundsError", [2561]: "TimeZoneInvalidOffsetError", [2562]: "TimeZoneMissingInputError", + [2563]: "TimeZoneInvalidIdError", [2816]: "NormalizerFutureExtensionError", [2817]: "NormalizerValidationError", }; @@ -168,6 +170,7 @@ export const ICU4XError = { "TimeZoneOffsetOutOfBoundsError": "TimeZoneOffsetOutOfBoundsError", "TimeZoneInvalidOffsetError": "TimeZoneInvalidOffsetError", "TimeZoneMissingInputError": "TimeZoneMissingInputError", + "TimeZoneInvalidIdError": "TimeZoneInvalidIdError", "NormalizerFutureExtensionError": "NormalizerFutureExtensionError", "NormalizerValidationError": "NormalizerValidationError", }; diff --git a/ffi/diplomat/js/include/ICU4XIanaToBcp47Mapper.d.ts b/ffi/diplomat/js/include/ICU4XIanaToBcp47Mapper.d.ts new file mode 100644 index 00000000000..a4ca2c7cb01 --- /dev/null +++ b/ffi/diplomat/js/include/ICU4XIanaToBcp47Mapper.d.ts @@ -0,0 +1,21 @@ +import { FFIError } from "./diplomat-runtime" +import { ICU4XDataProvider } from "./ICU4XDataProvider"; +import { ICU4XError } from "./ICU4XError"; + +/** + + * An object capable of mapping from an IANA time zone ID to a BCP-47 ID. + + * This can be used via `try_set_iana_time_zone_id_strict()` on {@link crate::timezone::ffi::ICU4XCustomTimeZone; `ICU4XCustomTimeZone`}. + + * See the {@link https://docs.rs/icu/latest/icu/timezone/struct.IanaToBcp47Mapper.html Rust documentation for `IanaToBcp47Mapper`} for more information. + */ +export class ICU4XIanaToBcp47Mapper { + + /** + + * See the {@link https://docs.rs/icu/latest/icu/timezone/struct.IanaToBcp47Mapper.html#method.try_new_unstable Rust documentation for `try_new_unstable`} for more information. + * @throws {@link FFIError}<{@link ICU4XError}> + */ + static create(provider: ICU4XDataProvider): ICU4XIanaToBcp47Mapper | never; +} diff --git a/ffi/diplomat/js/include/ICU4XIanaToBcp47Mapper.js b/ffi/diplomat/js/include/ICU4XIanaToBcp47Mapper.js new file mode 100644 index 00000000000..ee2c9318985 --- /dev/null +++ b/ffi/diplomat/js/include/ICU4XIanaToBcp47Mapper.js @@ -0,0 +1,35 @@ +import wasm from "./diplomat-wasm.mjs" +import * as diplomatRuntime from "./diplomat-runtime.js" +import { ICU4XError_js_to_rust, ICU4XError_rust_to_js } from "./ICU4XError.js" + +const ICU4XIanaToBcp47Mapper_box_destroy_registry = new FinalizationRegistry(underlying => { + wasm.ICU4XIanaToBcp47Mapper_destroy(underlying); +}); + +export class ICU4XIanaToBcp47Mapper { + #lifetimeEdges = []; + constructor(underlying, owned, edges) { + this.underlying = underlying; + this.#lifetimeEdges.push(...edges); + if (owned) { + ICU4XIanaToBcp47Mapper_box_destroy_registry.register(this, underlying); + } + } + + static create(arg_provider) { + return (() => { + const diplomat_receive_buffer = wasm.diplomat_alloc(5, 4); + wasm.ICU4XIanaToBcp47Mapper_create(diplomat_receive_buffer, arg_provider.underlying); + const is_ok = diplomatRuntime.resultFlag(wasm, diplomat_receive_buffer, 4); + if (is_ok) { + const ok_value = new ICU4XIanaToBcp47Mapper(diplomatRuntime.ptrRead(wasm, diplomat_receive_buffer), true, []); + wasm.diplomat_free(diplomat_receive_buffer, 5, 4); + return ok_value; + } else { + const throw_value = ICU4XError_rust_to_js[diplomatRuntime.enumDiscriminant(wasm, diplomat_receive_buffer)]; + wasm.diplomat_free(diplomat_receive_buffer, 5, 4); + throw new diplomatRuntime.FFIError(throw_value); + } + })(); + } +} diff --git a/ffi/diplomat/js/include/index.d.ts b/ffi/diplomat/js/include/index.d.ts index 3515d5fe666..8dc067324c6 100644 --- a/ffi/diplomat/js/include/index.d.ts +++ b/ffi/diplomat/js/include/index.d.ts @@ -2,6 +2,7 @@ export { FFIError, i8, u8, i16, u16, i32, u32, i64, u64, f32, f64, char } from ' export { CodePointRangeIterator } from './CodePointRangeIterator.js'; export { CodePointRangeIteratorResult } from './CodePointRangeIteratorResult.js'; export { ICU4XAnyCalendarKind } from './ICU4XAnyCalendarKind.js'; +export { ICU4XBcp47ToIanaMapper } from './ICU4XBcp47ToIanaMapper.js'; export { ICU4XBidi } from './ICU4XBidi.js'; export { ICU4XBidiDirection } from './ICU4XBidiDirection.js'; export { ICU4XBidiInfo } from './ICU4XBidiInfo.js'; @@ -50,6 +51,7 @@ export { ICU4XGraphemeClusterSegmenter } from './ICU4XGraphemeClusterSegmenter.j export { ICU4XGregorianDateFormatter } from './ICU4XGregorianDateFormatter.js'; export { ICU4XGregorianDateTimeFormatter } from './ICU4XGregorianDateTimeFormatter.js'; export { ICU4XGregorianZonedDateTimeFormatter } from './ICU4XGregorianZonedDateTimeFormatter.js'; +export { ICU4XIanaToBcp47Mapper } from './ICU4XIanaToBcp47Mapper.js'; export { ICU4XIsoDate } from './ICU4XIsoDate.js'; export { ICU4XIsoDateTime } from './ICU4XIsoDateTime.js'; export { ICU4XIsoTimeZoneFormat } from './ICU4XIsoTimeZoneFormat.js'; diff --git a/ffi/diplomat/js/include/index.js b/ffi/diplomat/js/include/index.js index ba954b2d401..d9e542f6ba6 100644 --- a/ffi/diplomat/js/include/index.js +++ b/ffi/diplomat/js/include/index.js @@ -2,6 +2,7 @@ export { FFIError } from './diplomat-runtime.js'; export { CodePointRangeIterator } from './CodePointRangeIterator.js'; export { CodePointRangeIteratorResult } from './CodePointRangeIteratorResult.js'; export { ICU4XAnyCalendarKind } from './ICU4XAnyCalendarKind.js'; +export { ICU4XBcp47ToIanaMapper } from './ICU4XBcp47ToIanaMapper.js'; export { ICU4XBidi } from './ICU4XBidi.js'; export { ICU4XBidiDirection } from './ICU4XBidiDirection.js'; export { ICU4XBidiInfo } from './ICU4XBidiInfo.js'; @@ -50,6 +51,7 @@ export { ICU4XGraphemeClusterSegmenter } from './ICU4XGraphemeClusterSegmenter.j export { ICU4XGregorianDateFormatter } from './ICU4XGregorianDateFormatter.js'; export { ICU4XGregorianDateTimeFormatter } from './ICU4XGregorianDateTimeFormatter.js'; export { ICU4XGregorianZonedDateTimeFormatter } from './ICU4XGregorianZonedDateTimeFormatter.js'; +export { ICU4XIanaToBcp47Mapper } from './ICU4XIanaToBcp47Mapper.js'; export { ICU4XIsoDate } from './ICU4XIsoDate.js'; export { ICU4XIsoDateTime } from './ICU4XIsoDateTime.js'; export { ICU4XIsoTimeZoneFormat } from './ICU4XIsoTimeZoneFormat.js'; diff --git a/ffi/diplomat/src/data_struct.rs b/ffi/diplomat/src/data_struct.rs index b2213209cf4..33f8fdfa27d 100644 --- a/ffi/diplomat/src/data_struct.rs +++ b/ffi/diplomat/src/data_struct.rs @@ -11,7 +11,9 @@ pub mod ffi { #[cfg(feature = "icu_decimal")] use crate::errors::ffi::ICU4XError; use alloc::boxed::Box; - use icu_provider::{AnyPayload, DataPayload}; + use icu_provider::AnyPayload; + #[cfg(feature = "icu_decimal")] + use icu_provider::DataPayload; #[diplomat::opaque] /// A generic data struct to be used by ICU4X diff --git a/ffi/diplomat/src/errors.rs b/ffi/diplomat/src/errors.rs index cd6210d0bc4..ed5ad554d89 100644 --- a/ffi/diplomat/src/errors.rs +++ b/ffi/diplomat/src/errors.rs @@ -144,6 +144,7 @@ pub mod ffi { TimeZoneOffsetOutOfBoundsError = 0xA_00, TimeZoneInvalidOffsetError = 0xA_01, TimeZoneMissingInputError = 0xA_02, + TimeZoneInvalidIdError = 0xA_03, // normalizer errors NormalizerFutureExtensionError = 0xB_00, diff --git a/ffi/diplomat/src/iana_bcp47_mapper.rs b/ffi/diplomat/src/iana_bcp47_mapper.rs new file mode 100644 index 00000000000..cbae40f7419 --- /dev/null +++ b/ffi/diplomat/src/iana_bcp47_mapper.rs @@ -0,0 +1,69 @@ +// This file is part of ICU4X. For terms of use, please see the file +// called LICENSE at the top level of the ICU4X source tree +// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). + +#[diplomat::bridge] +pub mod ffi { + use crate::errors::ffi::ICU4XError; + use crate::provider::ffi::ICU4XDataProvider; + use alloc::boxed::Box; + use icu_timezone::Bcp47ToIanaMapper; + use icu_timezone::IanaToBcp47Mapper; + use icu_timezone::TimeZoneBcp47Id; + + /// An object capable of mapping from an IANA time zone ID to a BCP-47 ID. + /// + /// This can be used via `try_set_iana_time_zone_id_strict()` on [`ICU4XCustomTimeZone`]. + /// + /// [`ICU4XCustomTimeZone`]: crate::timezone::ffi::ICU4XCustomTimeZone; + #[diplomat::opaque] + #[diplomat::rust_link(icu::timezone::IanaToBcp47Mapper, Struct)] + #[diplomat::rust_link(icu::timezone::IanaToBcp47Mapper::as_borrowed, FnInStruct, hidden)] + pub struct ICU4XIanaToBcp47Mapper(pub IanaToBcp47Mapper); + + impl ICU4XIanaToBcp47Mapper { + #[diplomat::rust_link(icu::timezone::IanaToBcp47Mapper::try_new_unstable, FnInStruct)] + pub fn create( + provider: &ICU4XDataProvider, + ) -> Result, ICU4XError> { + Ok(Box::new(ICU4XIanaToBcp47Mapper( + IanaToBcp47Mapper::try_new_unstable(&provider.0)?, + ))) + } + } + + /// An object capable of mapping from a BCP-47 time zone ID to an IANA ID. + #[diplomat::opaque] + #[diplomat::rust_link(icu::timezone::Bcp47ToIanaMapper, Struct)] + #[diplomat::rust_link(icu::timezone::Bcp47ToIanaMapper::as_borrowed, FnInStruct, hidden)] + pub struct ICU4XBcp47ToIanaMapper(pub Bcp47ToIanaMapper); + + impl ICU4XBcp47ToIanaMapper { + #[diplomat::rust_link(icu::timezone::Bcp47ToIanaMapper::try_new_unstable, FnInStruct)] + pub fn create( + provider: &ICU4XDataProvider, + ) -> Result, ICU4XError> { + Ok(Box::new(ICU4XBcp47ToIanaMapper( + Bcp47ToIanaMapper::try_new_unstable(&provider.0)?, + ))) + } + + /// Writes out the canonical IANA time zone ID corresponding to the given BCP-47 ID. + #[diplomat::rust_link(icu::datetime::time_zone::Bcp47ToIanaMapper::get, FnInStruct)] + pub fn get( + &self, + value: &str, + write: &mut diplomat_runtime::DiplomatWriteable, + ) -> Result<(), ICU4XError> { + use core::str::FromStr; + use writeable::Writeable; + let handle = self.0.as_borrowed(); + TimeZoneBcp47Id::from_str(value) + .ok() + .and_then(|bcp47_id| handle.get(bcp47_id)) + .ok_or(ICU4XError::TimeZoneInvalidIdError)? + .write_to(write)?; + Ok(()) + } + } +} diff --git a/ffi/diplomat/src/lib.rs b/ffi/diplomat/src/lib.rs index ef01a8e7789..6b4c44301ea 100644 --- a/ffi/diplomat/src/lib.rs +++ b/ffi/diplomat/src/lib.rs @@ -89,6 +89,8 @@ pub mod decimal; pub mod displaynames; #[cfg(feature = "icu_decimal")] pub mod fixed_decimal; +#[cfg(any(feature = "icu_datetime", feature = "icu_timezone"))] +pub mod iana_bcp47_mapper; #[cfg(feature = "icu_list")] pub mod list; #[cfg(feature = "icu_locid_transform")] diff --git a/ffi/diplomat/src/timezone.rs b/ffi/diplomat/src/timezone.rs index d7b28e7eb35..fffb367a8b5 100644 --- a/ffi/diplomat/src/timezone.rs +++ b/ffi/diplomat/src/timezone.rs @@ -137,6 +137,34 @@ pub mod ffi { Ok(()) } + #[diplomat::rust_link(icu::timezone::IanaToBcp47MapperBorrowed::get_strict, FnInStruct)] + pub fn try_set_iana_time_zone_id_strict( + &mut self, + mapper: &crate::iana_bcp47_mapper::ffi::ICU4XIanaToBcp47Mapper, + id: &str, + ) -> Result<(), ICU4XError> { + self.0.time_zone_id = mapper.0.as_borrowed().get_strict(id); + if self.0.time_zone_id.is_some() { + Ok(()) + } else { + Err(ICU4XError::TimeZoneInvalidIdError) + } + } + + #[diplomat::rust_link(icu::timezone::IanaToBcp47MapperBorrowed::get_loose, FnInStruct)] + pub fn try_set_iana_time_zone_id_loose( + &mut self, + mapper: &crate::iana_bcp47_mapper::ffi::ICU4XIanaToBcp47Mapper, + id: &str, + ) -> Result<(), ICU4XError> { + self.0.time_zone_id = mapper.0.as_borrowed().get_loose(id); + if self.0.time_zone_id.is_some() { + Ok(()) + } else { + Err(ICU4XError::TimeZoneInvalidIdError) + } + } + /// Clears the `time_zone_id` field. #[diplomat::rust_link(icu::timezone::CustomTimeZone::time_zone_id, StructField)] #[diplomat::rust_link(icu::timezone::TimeZoneBcp47Id, Struct, compact)] diff --git a/provider/datagen/src/registry.rs b/provider/datagen/src/registry.rs index 7516410e27e..8136ec6ead0 100644 --- a/provider/datagen/src/registry.rs +++ b/provider/datagen/src/registry.rs @@ -110,6 +110,7 @@ registry!( AndListV1Marker, AsciiHexDigitV1Marker, BasicEmojiV1Marker, + Bcp47ToIanaMapV1Marker, BidiClassV1Marker, BidiClassNameToValueV1Marker, BidiClassValueToLongNameV1Marker, @@ -193,6 +194,7 @@ registry!( GregorianDateSymbolsV1Marker, HexDigitV1Marker, HyphenV1Marker, + IanaToBcp47MapV1Marker, IdContinueV1Marker, IdeographicV1Marker, IdsBinaryOperatorV1Marker, diff --git a/provider/datagen/src/transform/cldr/time_zones/convert.rs b/provider/datagen/src/transform/cldr/time_zones/convert.rs index 5f6b58b5664..7726b342f7c 100644 --- a/provider/datagen/src/transform/cldr/time_zones/convert.rs +++ b/provider/datagen/src/transform/cldr/time_zones/convert.rs @@ -18,6 +18,7 @@ use icu_datetime::provider::time_zones::{ use icu_timezone::provider::MetazonePeriodV1; use icu_timezone::ZoneVariant; use std::borrow::Cow; +use std::collections::BTreeMap; use std::collections::HashMap; use tinystr::TinyStr8; @@ -41,10 +42,10 @@ fn parse_hour_format(hour_format: &str) -> (Cow<'static, str>, Cow<'static, str> (Cow::Owned(positive), Cow::Owned(negative)) } -fn compute_bcp47_tzids_hashmap( +pub(crate) fn compute_bcp47_tzids_btreemap( bcp47_tzids_resource: &HashMap, -) -> HashMap { - let mut bcp47_tzids = HashMap::new(); +) -> BTreeMap { + let mut bcp47_tzids = BTreeMap::new(); for (bcp47_tzid, bcp47_tzid_data) in bcp47_tzids_resource.iter() { if let Some(alias) = &bcp47_tzid_data.alias { for data_value in alias.split(' ') { @@ -173,7 +174,7 @@ impl From> for ExemplarCitiesV1<'static> { impl From> for MetazonePeriodV1<'static> { fn from(other: CldrTimeZonesData<'_>) -> Self { let data = other.meta_zone_periods_resource; - let bcp47_tzid_data = &compute_bcp47_tzids_hashmap(other.bcp47_tzids_resource); + let bcp47_tzid_data = &compute_bcp47_tzids_btreemap(other.bcp47_tzids_resource); let meta_zone_id_data = &compute_meta_zone_ids_hashmap(other.meta_zone_ids_resource); Self( data.iter() @@ -239,7 +240,7 @@ macro_rules! long_short_impls { impl From> for $generic { fn from(other: CldrTimeZonesData<'_>) -> Self { let data = other.time_zone_names_resource; - let bcp47_tzid_data = &compute_bcp47_tzids_hashmap(other.bcp47_tzids_resource); + let bcp47_tzid_data = &compute_bcp47_tzids_btreemap(other.bcp47_tzids_resource); let meta_zone_id_data = &compute_meta_zone_ids_hashmap(other.meta_zone_ids_resource); Self { @@ -326,7 +327,7 @@ macro_rules! long_short_impls { impl From> for $specific { fn from(other: CldrTimeZonesData<'_>) -> Self { let data = other.time_zone_names_resource; - let bcp47_tzid_data = &compute_bcp47_tzids_hashmap(other.bcp47_tzids_resource); + let bcp47_tzid_data = &compute_bcp47_tzids_btreemap(other.bcp47_tzids_resource); let meta_zone_id_data = &compute_meta_zone_ids_hashmap(other.meta_zone_ids_resource); Self { diff --git a/provider/datagen/src/transform/cldr/time_zones/mod.rs b/provider/datagen/src/transform/cldr/time_zones/mod.rs index bcbfbc2d248..8fa0281ebcb 100644 --- a/provider/datagen/src/transform/cldr/time_zones/mod.rs +++ b/provider/datagen/src/transform/cldr/time_zones/mod.rs @@ -15,6 +15,7 @@ use icu_timezone::provider::*; use std::collections::HashMap; mod convert; +mod names; #[derive(Debug, Copy, Clone)] struct CldrTimeZonesData<'a> { diff --git a/provider/datagen/src/transform/cldr/time_zones/names.rs b/provider/datagen/src/transform/cldr/time_zones/names.rs new file mode 100644 index 00000000000..125ba920cf7 --- /dev/null +++ b/provider/datagen/src/transform/cldr/time_zones/names.rs @@ -0,0 +1,65 @@ +// This file is part of ICU4X. For terms of use, please see the file +// called LICENSE at the top level of the ICU4X source tree +// (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). + +use super::convert::compute_bcp47_tzids_btreemap; +use crate::transform::cldr::cldr_serde; +use icu_provider::datagen::IterableDataProvider; +use icu_provider::prelude::*; +use icu_timezone::provider::names::*; + +impl DataProvider for crate::DatagenProvider { + fn load(&self, _: DataRequest) -> Result, DataError> { + let resource: &cldr_serde::time_zones::bcp47_tzid::Resource = + self.source + .cldr()? + .bcp47() + .read_and_parse("timezone.json")?; + let bcp47_tzid_data = &compute_bcp47_tzids_btreemap(&resource.keyword.u.time_zones.values); + let data_struct = IanaToBcp47MapV1 { + map: bcp47_tzid_data + .iter() + .map(|(k, v)| (NormalizedTimeZoneIdStr::boxed_from_bytes(k.as_bytes()), v)) + .collect(), + }; + Ok(DataResponse { + metadata: Default::default(), + payload: Some(DataPayload::from_owned(data_struct)), + }) + } +} + +impl IterableDataProvider for crate::DatagenProvider { + fn supported_locales(&self) -> Result, DataError> { + Ok(vec![Default::default()]) + } +} + +impl DataProvider for crate::DatagenProvider { + fn load(&self, _: DataRequest) -> Result, DataError> { + let resource: &cldr_serde::time_zones::bcp47_tzid::Resource = + self.source + .cldr()? + .bcp47() + .read_and_parse("timezone.json")?; + // Note: The BTreeMap retains the order of the aliases, which is important for establishing + // the canonical order of the IANA names. + let bcp47_tzid_data = &compute_bcp47_tzids_btreemap(&resource.keyword.u.time_zones.values); + let data_struct = Bcp47ToIanaMapV1 { + map: bcp47_tzid_data + .iter() + .map(|(k, v)| (v.0.to_unvalidated(), k.as_str())) + .collect(), + }; + Ok(DataResponse { + metadata: Default::default(), + payload: Some(DataPayload::from_owned(data_struct)), + }) + } +} + +impl IterableDataProvider for crate::DatagenProvider { + fn supported_locales(&self) -> Result, DataError> { + Ok(vec![Default::default()]) + } +} diff --git a/provider/repodata/data/json/fingerprints.csv b/provider/repodata/data/json/fingerprints.csv index a1d52710a08..c55a590a854 100644 --- a/provider/repodata/data/json/fingerprints.csv +++ b/provider/repodata/data/json/fingerprints.csv @@ -1562,6 +1562,7 @@ segmenter/line@1, und, 154400B, 36dc3e278178555e segmenter/lstm/wl_auto@1, th, 361075B, c0c627d25a7d72bf segmenter/sentence@1, und, 109564B, 9b71678f3be4f07f segmenter/word@1, und, 113449B, 1103532d45a51419 +time_zone/bcp47_to_iana@1, und, 14539B, 6d0362512d55bab9 time_zone/exemplar_cities@1, ar, 12513B, 40d4e7d38c2e9cf5 time_zone/exemplar_cities@1, ar-EG, 12513B, 40d4e7d38c2e9cf5 time_zone/exemplar_cities@1, bn, 17309B, 877d5071f386c12a @@ -1638,6 +1639,7 @@ time_zone/generic_short@1, sr-Latn, 138B, a4b2548c5cbaee3d time_zone/generic_short@1, th, 60B, f2684ef71a14efa time_zone/generic_short@1, tr, 60B, f2684ef71a14efa time_zone/generic_short@1, und, 60B, f2684ef71a14efa +time_zone/iana_to_bcp47@1, und, 18678B, 4a0dcf968e4fadae time_zone/metazone_period@1, und, 20485B, 63f36c3252f47b76 time_zone/specific_long@1, ar, 16042B, 49cfd1546ed410f time_zone/specific_long@1, ar-EG, 16042B, 49cfd1546ed410f diff --git a/provider/repodata/data/json/time_zone/bcp47_to_iana@1/und.json b/provider/repodata/data/json/time_zone/bcp47_to_iana@1/und.json new file mode 100644 index 00000000000..439bf34092a --- /dev/null +++ b/provider/repodata/data/json/time_zone/bcp47_to_iana@1/und.json @@ -0,0 +1,465 @@ +{ + "map": { + "adalv": "Europe/Andorra", + "aedxb": "Asia/Dubai", + "afkbl": "Asia/Kabul", + "aganu": "America/Antigua", + "aiaxa": "America/Anguilla", + "altia": "Europe/Tirane", + "amevn": "Asia/Yerevan", + "ancur": "America/Curacao", + "aolad": "Africa/Luanda", + "aqcas": "Antarctica/Casey", + "aqdav": "Antarctica/Davis", + "aqddu": "Antarctica/DumontDUrville", + "aqmaw": "Antarctica/Mawson", + "aqmcm": "Antarctica/McMurdo", + "aqplm": "Antarctica/Palmer", + "aqrot": "Antarctica/Rothera", + "aqsyw": "Antarctica/Syowa", + "aqtrl": "Antarctica/Troll", + "aqvos": "Antarctica/Vostok", + "arbue": "America/Buenos_Aires", + "arcor": "America/Rosario", + "arctc": "America/Catamarca", + "arirj": "America/Argentina/La_Rioja", + "arjuj": "America/Jujuy", + "arluq": "America/Argentina/San_Luis", + "armdz": "America/Mendoza", + "arrgl": "America/Argentina/Rio_Gallegos", + "arsla": "America/Argentina/Salta", + "artuc": "America/Argentina/Tucuman", + "aruaq": "America/Argentina/San_Juan", + "arush": "America/Argentina/Ushuaia", + "asppg": "US/Samoa", + "atvie": "Europe/Vienna", + "auadl": "Australia/South", + "aubhq": "Australia/Yancowinna", + "aubne": "Australia/Queensland", + "audrw": "Australia/North", + "aueuc": "Australia/Eucla", + "auhba": "Australia/Tasmania", + "aukns": "Australia/Currie", + "auldc": "Australia/Lindeman", + "auldh": "Australia/Lord_Howe", + "aumel": "Australia/Victoria", + "aumqi": "Antarctica/Macquarie", + "auper": "Australia/West", + "ausyd": "Australia/Sydney", + "awaua": "America/Aruba", + "azbak": "Asia/Baku", + "basjj": "Europe/Sarajevo", + "bbbgi": "America/Barbados", + "bddac": "Asia/Dhaka", + "bebru": "Europe/Brussels", + "bfoua": "Africa/Ouagadougou", + "bgsof": "Europe/Sofia", + "bhbah": "Asia/Bahrain", + "bibjm": "Africa/Bujumbura", + "bjptn": "Africa/Porto-Novo", + "bmbda": "Atlantic/Bermuda", + "bnbwn": "Asia/Brunei", + "bolpb": "America/La_Paz", + "bqkra": "America/Kralendijk", + "braux": "America/Araguaina", + "brbel": "America/Belem", + "brbvb": "America/Boa_Vista", + "brcgb": "America/Cuiaba", + "brcgr": "America/Campo_Grande", + "brern": "America/Eirunepe", + "brfen": "Brazil/DeNoronha", + "brfor": "America/Fortaleza", + "brmao": "Brazil/West", + "brmcz": "America/Maceio", + "brpvh": "America/Porto_Velho", + "brrbr": "Brazil/Acre", + "brrec": "America/Recife", + "brsao": "Brazil/East", + "brssa": "America/Bahia", + "brstm": "America/Santarem", + "bsnas": "America/Nassau", + "btthi": "Asia/Thimphu", + "bwgbe": "Africa/Gaborone", + "bymsq": "Europe/Minsk", + "bzbze": "America/Belize", + "cacfq": "America/Creston", + "caedm": "Canada/Mountain", + "caffs": "America/Rainy_River", + "cafne": "America/Fort_Nelson", + "caglb": "America/Glace_Bay", + "cagoo": "America/Goose_Bay", + "cahal": "Canada/Atlantic", + "caiql": "America/Iqaluit", + "camon": "America/Moncton", + "canpg": "America/Nipigon", + "capnt": "America/Pangnirtung", + "careb": "America/Resolute", + "careg": "Canada/Saskatchewan", + "casjf": "Canada/Newfoundland", + "cathu": "America/Thunder_Bay", + "cator": "Canada/Eastern", + "cavan": "Canada/Pacific", + "cawnp": "Canada/Central", + "caybx": "America/Blanc-Sablon", + "caycb": "America/Cambridge_Bay", + "cayda": "America/Dawson", + "caydq": "America/Dawson_Creek", + "cayek": "America/Rankin_Inlet", + "cayev": "America/Inuvik", + "cayxy": "Canada/Yukon", + "cayyn": "America/Swift_Current", + "cayzf": "America/Yellowknife", + "cayzs": "America/Coral_Harbour", + "cccck": "Indian/Cocos", + "cdfbm": "Africa/Lubumbashi", + "cdfih": "Africa/Kinshasa", + "cfbgf": "Africa/Bangui", + "cgbzv": "Africa/Brazzaville", + "chzrh": "Europe/Zurich", + "ciabj": "Africa/Abidjan", + "ckrar": "Pacific/Rarotonga", + "clipc": "Pacific/Easter", + "clpuq": "America/Punta_Arenas", + "clscl": "Chile/Continental", + "cmdla": "Africa/Douala", + "cnsha": "PRC", + "cnurc": "Asia/Urumqi", + "cobog": "America/Bogota", + "crsjo": "America/Costa_Rica", + "cst6cdt": "CST6CDT", + "cuhav": "Cuba", + "cvrai": "Atlantic/Cape_Verde", + "cxxch": "Indian/Christmas", + "cyfmg": "Asia/Famagusta", + "cynic": "Europe/Nicosia", + "czprg": "Europe/Prague", + "deber": "Europe/Berlin", + "debsngn": "Europe/Busingen", + "djjib": "Africa/Djibouti", + "dkcph": "Europe/Copenhagen", + "dmdom": "America/Dominica", + "dosdq": "America/Santo_Domingo", + "dzalg": "Africa/Algiers", + "ecgps": "Pacific/Galapagos", + "ecgye": "America/Guayaquil", + "eetll": "Europe/Tallinn", + "egcai": "Egypt", + "eheai": "Africa/El_Aaiun", + "erasm": "Africa/Asmera", + "esceu": "Africa/Ceuta", + "eslpa": "Atlantic/Canary", + "esmad": "Europe/Madrid", + "est5edt": "EST5EDT", + "etadd": "Africa/Addis_Ababa", + "fihel": "Europe/Helsinki", + "fimhq": "Europe/Mariehamn", + "fjsuv": "Pacific/Fiji", + "fkpsy": "Atlantic/Stanley", + "fmksa": "Pacific/Kosrae", + "fmpni": "Pacific/Ponape", + "fmtkk": "Pacific/Yap", + "fotho": "Atlantic/Faroe", + "frpar": "Europe/Paris", + "galbv": "Africa/Libreville", + "gazastrp": "Asia/Gaza", + "gblon": "GB-Eire", + "gdgnd": "America/Grenada", + "getbs": "Asia/Tbilisi", + "gfcay": "America/Cayenne", + "gggci": "Europe/Guernsey", + "ghacc": "Africa/Accra", + "gigib": "Europe/Gibraltar", + "gldkshvn": "America/Danmarkshavn", + "glgoh": "America/Nuuk", + "globy": "America/Scoresbysund", + "glthu": "America/Thule", + "gmbjl": "Africa/Banjul", + "gmt": "Greenwich", + "gncky": "Africa/Conakry", + "gpbbr": "America/Guadeloupe", + "gpmsb": "America/Marigot", + "gpsbh": "America/St_Barthelemy", + "gqssg": "Africa/Malabo", + "grath": "Europe/Athens", + "gsgrv": "Atlantic/South_Georgia", + "gtgua": "America/Guatemala", + "gugum": "Pacific/Guam", + "gwoxb": "Africa/Bissau", + "gygeo": "America/Guyana", + "hebron": "Asia/Hebron", + "hkhkg": "Hongkong", + "hntgu": "America/Tegucigalpa", + "hrzag": "Europe/Zagreb", + "htpap": "America/Port-au-Prince", + "hubud": "Europe/Budapest", + "iddjj": "Asia/Jayapura", + "idjkt": "Asia/Jakarta", + "idmak": "Asia/Ujung_Pandang", + "idpnk": "Asia/Pontianak", + "iedub": "Europe/Dublin", + "imdgs": "Europe/Isle_of_Man", + "inccu": "Asia/Kolkata", + "iodga": "Indian/Chagos", + "iqbgw": "Asia/Baghdad", + "irthr": "Iran", + "isrey": "Iceland", + "itrom": "Europe/Rome", + "jeruslm": "Israel", + "jesth": "Europe/Jersey", + "jmkin": "Jamaica", + "joamm": "Asia/Amman", + "jptyo": "Japan", + "kenbo": "Africa/Nairobi", + "kgfru": "Asia/Bishkek", + "khpnh": "Asia/Phnom_Penh", + "kicxi": "Pacific/Kiritimati", + "kipho": "Pacific/Kanton", + "kitrw": "Pacific/Tarawa", + "kmyva": "Indian/Comoro", + "knbas": "America/St_Kitts", + "kpfnj": "Asia/Pyongyang", + "krsel": "ROK", + "kwkwi": "Asia/Kuwait", + "kygec": "America/Cayman", + "kzaau": "Asia/Aqtau", + "kzakx": "Asia/Aqtobe", + "kzala": "Asia/Almaty", + "kzguw": "Asia/Atyrau", + "kzksn": "Asia/Qostanay", + "kzkzo": "Asia/Qyzylorda", + "kzura": "Asia/Oral", + "lavte": "Asia/Vientiane", + "lbbey": "Asia/Beirut", + "lccas": "America/St_Lucia", + "livdz": "Europe/Vaduz", + "lkcmb": "Asia/Colombo", + "lrmlw": "Africa/Monrovia", + "lsmsu": "Africa/Maseru", + "ltvno": "Europe/Vilnius", + "lulux": "Europe/Luxembourg", + "lvrix": "Europe/Riga", + "lytip": "Libya", + "macas": "Africa/Casablanca", + "mcmon": "Europe/Monaco", + "mdkiv": "Europe/Tiraspol", + "metgd": "Europe/Podgorica", + "mgtnr": "Indian/Antananarivo", + "mhkwa": "Pacific/Kwajalein", + "mhmaj": "Pacific/Majuro", + "mkskp": "Europe/Skopje", + "mlbko": "Africa/Timbuktu", + "mmrgn": "Asia/Yangon", + "mncoq": "Asia/Choibalsan", + "mnhvd": "Asia/Hovd", + "mnuln": "Asia/Ulan_Bator", + "momfm": "Asia/Macau", + "mpspn": "Pacific/Saipan", + "mqfdf": "America/Martinique", + "mrnkc": "Africa/Nouakchott", + "msmni": "America/Montserrat", + "mst7mdt": "MST7MDT", + "mtmla": "Europe/Malta", + "muplu": "Indian/Mauritius", + "mvmle": "Indian/Maldives", + "mwblz": "Africa/Blantyre", + "mxchi": "America/Chihuahua", + "mxcjs": "America/Ciudad_Juarez", + "mxcun": "America/Cancun", + "mxhmo": "America/Hermosillo", + "mxmam": "America/Matamoros", + "mxmex": "Mexico/General", + "mxmid": "America/Merida", + "mxmty": "America/Monterrey", + "mxmzt": "Mexico/BajaSur", + "mxoji": "America/Ojinaga", + "mxpvr": "America/Bahia_Banderas", + "mxstis": "America/Santa_Isabel", + "mxtij": "Mexico/BajaNorte", + "mykch": "Asia/Kuching", + "mykul": "Asia/Kuala_Lumpur", + "mzmpm": "Africa/Maputo", + "nawdh": "Africa/Windhoek", + "ncnou": "Pacific/Noumea", + "nenim": "Africa/Niamey", + "nfnlk": "Pacific/Norfolk", + "nglos": "Africa/Lagos", + "nimga": "America/Managua", + "nlams": "Europe/Amsterdam", + "noosl": "Europe/Oslo", + "npktm": "Asia/Katmandu", + "nrinu": "Pacific/Nauru", + "nuiue": "Pacific/Niue", + "nzakl": "Pacific/Auckland", + "nzcht": "Pacific/Chatham", + "ommct": "Asia/Muscat", + "papty": "America/Panama", + "pelim": "America/Lima", + "pfgmr": "Pacific/Gambier", + "pfnhv": "Pacific/Marquesas", + "pfppt": "Pacific/Tahiti", + "pgpom": "Pacific/Port_Moresby", + "pgraw": "Pacific/Bougainville", + "phmnl": "Asia/Manila", + "pkkhi": "Asia/Karachi", + "plwaw": "Poland", + "pmmqc": "America/Miquelon", + "pnpcn": "Pacific/Pitcairn", + "prsju": "America/Puerto_Rico", + "pst8pdt": "PST8PDT", + "ptfnc": "Atlantic/Madeira", + "ptlis": "Portugal", + "ptpdl": "Atlantic/Azores", + "pwror": "Pacific/Palau", + "pyasu": "America/Asuncion", + "qadoh": "Asia/Qatar", + "rereu": "Indian/Reunion", + "robuh": "Europe/Bucharest", + "rsbeg": "Europe/Belgrade", + "ruasf": "Europe/Astrakhan", + "rubax": "Asia/Barnaul", + "ruchita": "Asia/Chita", + "rudyr": "Asia/Anadyr", + "rugdx": "Asia/Magadan", + "ruikt": "Asia/Irkutsk", + "rukgd": "Europe/Kaliningrad", + "rukhndg": "Asia/Khandyga", + "rukra": "Asia/Krasnoyarsk", + "rukuf": "Europe/Samara", + "rukvx": "Europe/Kirov", + "rumow": "W-SU", + "runoz": "Asia/Novokuznetsk", + "ruoms": "Asia/Omsk", + "ruovb": "Asia/Novosibirsk", + "rupkc": "Asia/Kamchatka", + "rurtw": "Europe/Saratov", + "rusred": "Asia/Srednekolymsk", + "rutof": "Asia/Tomsk", + "ruuly": "Europe/Ulyanovsk", + "ruunera": "Asia/Ust-Nera", + "ruuus": "Asia/Sakhalin", + "ruvog": "Europe/Volgograd", + "ruvvo": "Asia/Vladivostok", + "ruyek": "Asia/Yekaterinburg", + "ruyks": "Asia/Yakutsk", + "rwkgl": "Africa/Kigali", + "saruh": "Asia/Riyadh", + "sbhir": "Pacific/Guadalcanal", + "scmaw": "Indian/Mahe", + "sdkrt": "Africa/Khartoum", + "sesto": "Europe/Stockholm", + "sgsin": "Singapore", + "shshn": "Atlantic/St_Helena", + "silju": "Europe/Ljubljana", + "sjlyr": "Atlantic/Jan_Mayen", + "skbts": "Europe/Bratislava", + "slfna": "Africa/Freetown", + "smsai": "Europe/San_Marino", + "sndkr": "Africa/Dakar", + "somgq": "Africa/Mogadishu", + "srpbm": "America/Paramaribo", + "ssjub": "Africa/Juba", + "sttms": "Africa/Sao_Tome", + "svsal": "America/El_Salvador", + "sxphi": "America/Lower_Princes", + "sydam": "Asia/Damascus", + "szqmn": "Africa/Mbabane", + "tcgdt": "America/Grand_Turk", + "tdndj": "Africa/Ndjamena", + "tfpfr": "Indian/Kerguelen", + "tglfw": "Africa/Lome", + "thbkk": "Asia/Bangkok", + "tjdyu": "Asia/Dushanbe", + "tkfko": "Pacific/Fakaofo", + "tldil": "Asia/Dili", + "tmasb": "Asia/Ashkhabad", + "tntun": "Africa/Tunis", + "totbu": "Pacific/Tongatapu", + "trist": "Turkey", + "ttpos": "America/Port_of_Spain", + "tvfun": "Pacific/Funafuti", + "twtpe": "ROC", + "tzdar": "Africa/Dar_es_Salaam", + "uaiev": "Europe/Kyiv", + "uaozh": "Europe/Zaporozhye", + "uasip": "Europe/Simferopol", + "uauzh": "Europe/Uzhgorod", + "ugkla": "Africa/Kampala", + "umawk": "Pacific/Wake", + "umjon": "Pacific/Johnston", + "ummdy": "Pacific/Midway", + "unk": "Etc/Unknown", + "usadk": "US/Aleutian", + "usaeg": "America/Indiana/Marengo", + "usanc": "US/Alaska", + "usboi": "America/Boise", + "uschi": "US/Central", + "usden": "US/Mountain", + "usdet": "US/Michigan", + "ushnl": "US/Hawaii", + "usind": "US/East-Indiana", + "usinvev": "America/Indiana/Vevay", + "usjnu": "America/Juneau", + "usknx": "US/Indiana-Starke", + "uslax": "US/Pacific-New", + "uslui": "America/Louisville", + "usmnm": "America/Menominee", + "usmoc": "America/Kentucky/Monticello", + "usmtm": "America/Metlakatla", + "usndcnt": "America/North_Dakota/Center", + "usndnsl": "America/North_Dakota/New_Salem", + "usnyc": "US/Eastern", + "usoea": "America/Indiana/Vincennes", + "usome": "America/Nome", + "usphx": "US/Arizona", + "ussit": "America/Sitka", + "ustel": "America/Indiana/Tell_City", + "uswlz": "America/Indiana/Winamac", + "uswsq": "America/Indiana/Petersburg", + "usxul": "America/North_Dakota/Beulah", + "usyak": "America/Yakutat", + "utc": "Zulu", + "utce01": "Etc/GMT-1", + "utce02": "Etc/GMT-2", + "utce03": "Etc/GMT-3", + "utce04": "Etc/GMT-4", + "utce05": "Etc/GMT-5", + "utce06": "Etc/GMT-6", + "utce07": "Etc/GMT-7", + "utce08": "Etc/GMT-8", + "utce09": "Etc/GMT-9", + "utce10": "Etc/GMT-10", + "utce11": "Etc/GMT-11", + "utce12": "Etc/GMT-12", + "utce13": "Etc/GMT-13", + "utce14": "Etc/GMT-14", + "utcw01": "Etc/GMT+1", + "utcw02": "Etc/GMT+2", + "utcw03": "Etc/GMT+3", + "utcw04": "Etc/GMT+4", + "utcw05": "Etc/GMT+5", + "utcw06": "Etc/GMT+6", + "utcw07": "MST", + "utcw08": "Etc/GMT+8", + "utcw09": "Etc/GMT+9", + "utcw10": "HST", + "utcw11": "Etc/GMT+11", + "utcw12": "Etc/GMT+12", + "uymvd": "America/Montevideo", + "uzskd": "Asia/Samarkand", + "uztas": "Asia/Tashkent", + "vavat": "Europe/Vatican", + "vcsvd": "America/St_Vincent", + "veccs": "America/Caracas", + "vgtov": "America/Tortola", + "vistt": "America/Virgin", + "vnsgn": "Asia/Saigon", + "vuvli": "Pacific/Efate", + "wfmau": "Pacific/Wallis", + "wsapw": "Pacific/Apia", + "yeade": "Asia/Aden", + "ytmam": "Indian/Mayotte", + "zajnb": "Africa/Johannesburg", + "zmlun": "Africa/Lusaka", + "zwhre": "Africa/Harare" + } +} diff --git a/provider/repodata/data/json/time_zone/iana_to_bcp47@1/und.json b/provider/repodata/data/json/time_zone/iana_to_bcp47@1/und.json new file mode 100644 index 00000000000..ac1284f6e7f --- /dev/null +++ b/provider/repodata/data/json/time_zone/iana_to_bcp47@1/und.json @@ -0,0 +1,599 @@ +{ + "map": { + "Africa/Abidjan": "ciabj", + "Africa/Accra": "ghacc", + "Africa/Addis_Ababa": "etadd", + "Africa/Algiers": "dzalg", + "Africa/Asmara": "erasm", + "Africa/Asmera": "erasm", + "Africa/Bamako": "mlbko", + "Africa/Bangui": "cfbgf", + "Africa/Banjul": "gmbjl", + "Africa/Bissau": "gwoxb", + "Africa/Blantyre": "mwblz", + "Africa/Brazzaville": "cgbzv", + "Africa/Bujumbura": "bibjm", + "Africa/Cairo": "egcai", + "Africa/Casablanca": "macas", + "Africa/Ceuta": "esceu", + "Africa/Conakry": "gncky", + "Africa/Dakar": "sndkr", + "Africa/Dar_es_Salaam": "tzdar", + "Africa/Djibouti": "djjib", + "Africa/Douala": "cmdla", + "Africa/El_Aaiun": "eheai", + "Africa/Freetown": "slfna", + "Africa/Gaborone": "bwgbe", + "Africa/Harare": "zwhre", + "Africa/Johannesburg": "zajnb", + "Africa/Juba": "ssjub", + "Africa/Kampala": "ugkla", + "Africa/Khartoum": "sdkrt", + "Africa/Kigali": "rwkgl", + "Africa/Kinshasa": "cdfih", + "Africa/Lagos": "nglos", + "Africa/Libreville": "galbv", + "Africa/Lome": "tglfw", + "Africa/Luanda": "aolad", + "Africa/Lubumbashi": "cdfbm", + "Africa/Lusaka": "zmlun", + "Africa/Malabo": "gqssg", + "Africa/Maputo": "mzmpm", + "Africa/Maseru": "lsmsu", + "Africa/Mbabane": "szqmn", + "Africa/Mogadishu": "somgq", + "Africa/Monrovia": "lrmlw", + "Africa/Nairobi": "kenbo", + "Africa/Ndjamena": "tdndj", + "Africa/Niamey": "nenim", + "Africa/Nouakchott": "mrnkc", + "Africa/Ouagadougou": "bfoua", + "Africa/Porto-Novo": "bjptn", + "Africa/Sao_Tome": "sttms", + "Africa/Timbuktu": "mlbko", + "Africa/Tripoli": "lytip", + "Africa/Tunis": "tntun", + "Africa/Windhoek": "nawdh", + "America/Adak": "usadk", + "America/Anchorage": "usanc", + "America/Anguilla": "aiaxa", + "America/Antigua": "aganu", + "America/Araguaina": "braux", + "America/Argentina/Buenos_Aires": "arbue", + "America/Argentina/Catamarca": "arctc", + "America/Argentina/ComodRivadavia": "arctc", + "America/Argentina/Cordoba": "arcor", + "America/Argentina/Jujuy": "arjuj", + "America/Argentina/La_Rioja": "arirj", + "America/Argentina/Mendoza": "armdz", + "America/Argentina/Rio_Gallegos": "arrgl", + "America/Argentina/Salta": "arsla", + "America/Argentina/San_Juan": "aruaq", + "America/Argentina/San_Luis": "arluq", + "America/Argentina/Tucuman": "artuc", + "America/Argentina/Ushuaia": "arush", + "America/Aruba": "awaua", + "America/Asuncion": "pyasu", + "America/Atikokan": "cayzs", + "America/Atka": "usadk", + "America/Bahia": "brssa", + "America/Bahia_Banderas": "mxpvr", + "America/Barbados": "bbbgi", + "America/Belem": "brbel", + "America/Belize": "bzbze", + "America/Blanc-Sablon": "caybx", + "America/Boa_Vista": "brbvb", + "America/Bogota": "cobog", + "America/Boise": "usboi", + "America/Buenos_Aires": "arbue", + "America/Cambridge_Bay": "caycb", + "America/Campo_Grande": "brcgr", + "America/Cancun": "mxcun", + "America/Caracas": "veccs", + "America/Catamarca": "arctc", + "America/Cayenne": "gfcay", + "America/Cayman": "kygec", + "America/Chicago": "uschi", + "America/Chihuahua": "mxchi", + "America/Ciudad_Juarez": "mxcjs", + "America/Coral_Harbour": "cayzs", + "America/Cordoba": "arcor", + "America/Costa_Rica": "crsjo", + "America/Creston": "cacfq", + "America/Cuiaba": "brcgb", + "America/Curacao": "ancur", + "America/Danmarkshavn": "gldkshvn", + "America/Dawson": "cayda", + "America/Dawson_Creek": "caydq", + "America/Denver": "usden", + "America/Detroit": "usdet", + "America/Dominica": "dmdom", + "America/Edmonton": "caedm", + "America/Eirunepe": "brern", + "America/El_Salvador": "svsal", + "America/Ensenada": "mxtij", + "America/Fort_Nelson": "cafne", + "America/Fort_Wayne": "usind", + "America/Fortaleza": "brfor", + "America/Glace_Bay": "caglb", + "America/Godthab": "glgoh", + "America/Goose_Bay": "cagoo", + "America/Grand_Turk": "tcgdt", + "America/Grenada": "gdgnd", + "America/Guadeloupe": "gpbbr", + "America/Guatemala": "gtgua", + "America/Guayaquil": "ecgye", + "America/Guyana": "gygeo", + "America/Halifax": "cahal", + "America/Havana": "cuhav", + "America/Hermosillo": "mxhmo", + "America/Indiana/Indianapolis": "usind", + "America/Indiana/Knox": "usknx", + "America/Indiana/Marengo": "usaeg", + "America/Indiana/Petersburg": "uswsq", + "America/Indiana/Tell_City": "ustel", + "America/Indiana/Vevay": "usinvev", + "America/Indiana/Vincennes": "usoea", + "America/Indiana/Winamac": "uswlz", + "America/Indianapolis": "usind", + "America/Inuvik": "cayev", + "America/Iqaluit": "caiql", + "America/Jamaica": "jmkin", + "America/Jujuy": "arjuj", + "America/Juneau": "usjnu", + "America/Kentucky/Louisville": "uslui", + "America/Kentucky/Monticello": "usmoc", + "America/Knox_IN": "usknx", + "America/Kralendijk": "bqkra", + "America/La_Paz": "bolpb", + "America/Lima": "pelim", + "America/Los_Angeles": "uslax", + "America/Louisville": "uslui", + "America/Lower_Princes": "sxphi", + "America/Maceio": "brmcz", + "America/Managua": "nimga", + "America/Manaus": "brmao", + "America/Marigot": "gpmsb", + "America/Martinique": "mqfdf", + "America/Matamoros": "mxmam", + "America/Mazatlan": "mxmzt", + "America/Mendoza": "armdz", + "America/Menominee": "usmnm", + "America/Merida": "mxmid", + "America/Metlakatla": "usmtm", + "America/Mexico_City": "mxmex", + "America/Miquelon": "pmmqc", + "America/Moncton": "camon", + "America/Monterrey": "mxmty", + "America/Montevideo": "uymvd", + "America/Montreal": "cator", + "America/Montserrat": "msmni", + "America/Nassau": "bsnas", + "America/New_York": "usnyc", + "America/Nipigon": "canpg", + "America/Nome": "usome", + "America/Noronha": "brfen", + "America/North_Dakota/Beulah": "usxul", + "America/North_Dakota/Center": "usndcnt", + "America/North_Dakota/New_Salem": "usndnsl", + "America/Nuuk": "glgoh", + "America/Ojinaga": "mxoji", + "America/Panama": "papty", + "America/Pangnirtung": "capnt", + "America/Paramaribo": "srpbm", + "America/Phoenix": "usphx", + "America/Port-au-Prince": "htpap", + "America/Port_of_Spain": "ttpos", + "America/Porto_Acre": "brrbr", + "America/Porto_Velho": "brpvh", + "America/Puerto_Rico": "prsju", + "America/Punta_Arenas": "clpuq", + "America/Rainy_River": "caffs", + "America/Rankin_Inlet": "cayek", + "America/Recife": "brrec", + "America/Regina": "careg", + "America/Resolute": "careb", + "America/Rio_Branco": "brrbr", + "America/Rosario": "arcor", + "America/Santa_Isabel": "mxstis", + "America/Santarem": "brstm", + "America/Santiago": "clscl", + "America/Santo_Domingo": "dosdq", + "America/Sao_Paulo": "brsao", + "America/Scoresbysund": "globy", + "America/Shiprock": "usden", + "America/Sitka": "ussit", + "America/St_Barthelemy": "gpsbh", + "America/St_Johns": "casjf", + "America/St_Kitts": "knbas", + "America/St_Lucia": "lccas", + "America/St_Thomas": "vistt", + "America/St_Vincent": "vcsvd", + "America/Swift_Current": "cayyn", + "America/Tegucigalpa": "hntgu", + "America/Thule": "glthu", + "America/Thunder_Bay": "cathu", + "America/Tijuana": "mxtij", + "America/Toronto": "cator", + "America/Tortola": "vgtov", + "America/Vancouver": "cavan", + "America/Virgin": "vistt", + "America/Whitehorse": "cayxy", + "America/Winnipeg": "cawnp", + "America/Yakutat": "usyak", + "America/Yellowknife": "cayzf", + "Antarctica/Casey": "aqcas", + "Antarctica/Davis": "aqdav", + "Antarctica/DumontDUrville": "aqddu", + "Antarctica/Macquarie": "aumqi", + "Antarctica/Mawson": "aqmaw", + "Antarctica/McMurdo": "aqmcm", + "Antarctica/Palmer": "aqplm", + "Antarctica/Rothera": "aqrot", + "Antarctica/South_Pole": "nzakl", + "Antarctica/Syowa": "aqsyw", + "Antarctica/Troll": "aqtrl", + "Antarctica/Vostok": "aqvos", + "Arctic/Longyearbyen": "sjlyr", + "Asia/Aden": "yeade", + "Asia/Almaty": "kzala", + "Asia/Amman": "joamm", + "Asia/Anadyr": "rudyr", + "Asia/Aqtau": "kzaau", + "Asia/Aqtobe": "kzakx", + "Asia/Ashgabat": "tmasb", + "Asia/Ashkhabad": "tmasb", + "Asia/Atyrau": "kzguw", + "Asia/Baghdad": "iqbgw", + "Asia/Bahrain": "bhbah", + "Asia/Baku": "azbak", + "Asia/Bangkok": "thbkk", + "Asia/Barnaul": "rubax", + "Asia/Beirut": "lbbey", + "Asia/Bishkek": "kgfru", + "Asia/Brunei": "bnbwn", + "Asia/Calcutta": "inccu", + "Asia/Chita": "ruchita", + "Asia/Choibalsan": "mncoq", + "Asia/Chongqing": "cnsha", + "Asia/Chungking": "cnsha", + "Asia/Colombo": "lkcmb", + "Asia/Dacca": "bddac", + "Asia/Damascus": "sydam", + "Asia/Dhaka": "bddac", + "Asia/Dili": "tldil", + "Asia/Dubai": "aedxb", + "Asia/Dushanbe": "tjdyu", + "Asia/Famagusta": "cyfmg", + "Asia/Gaza": "gazastrp", + "Asia/Harbin": "cnsha", + "Asia/Hebron": "hebron", + "Asia/Ho_Chi_Minh": "vnsgn", + "Asia/Hong_Kong": "hkhkg", + "Asia/Hovd": "mnhvd", + "Asia/Irkutsk": "ruikt", + "Asia/Istanbul": "trist", + "Asia/Jakarta": "idjkt", + "Asia/Jayapura": "iddjj", + "Asia/Jerusalem": "jeruslm", + "Asia/Kabul": "afkbl", + "Asia/Kamchatka": "rupkc", + "Asia/Karachi": "pkkhi", + "Asia/Kashgar": "cnurc", + "Asia/Kathmandu": "npktm", + "Asia/Katmandu": "npktm", + "Asia/Khandyga": "rukhndg", + "Asia/Kolkata": "inccu", + "Asia/Krasnoyarsk": "rukra", + "Asia/Kuala_Lumpur": "mykul", + "Asia/Kuching": "mykch", + "Asia/Kuwait": "kwkwi", + "Asia/Macao": "momfm", + "Asia/Macau": "momfm", + "Asia/Magadan": "rugdx", + "Asia/Makassar": "idmak", + "Asia/Manila": "phmnl", + "Asia/Muscat": "ommct", + "Asia/Nicosia": "cynic", + "Asia/Novokuznetsk": "runoz", + "Asia/Novosibirsk": "ruovb", + "Asia/Omsk": "ruoms", + "Asia/Oral": "kzura", + "Asia/Phnom_Penh": "khpnh", + "Asia/Pontianak": "idpnk", + "Asia/Pyongyang": "kpfnj", + "Asia/Qatar": "qadoh", + "Asia/Qostanay": "kzksn", + "Asia/Qyzylorda": "kzkzo", + "Asia/Rangoon": "mmrgn", + "Asia/Riyadh": "saruh", + "Asia/Saigon": "vnsgn", + "Asia/Sakhalin": "ruuus", + "Asia/Samarkand": "uzskd", + "Asia/Seoul": "krsel", + "Asia/Shanghai": "cnsha", + "Asia/Singapore": "sgsin", + "Asia/Srednekolymsk": "rusred", + "Asia/Taipei": "twtpe", + "Asia/Tashkent": "uztas", + "Asia/Tbilisi": "getbs", + "Asia/Tehran": "irthr", + "Asia/Tel_Aviv": "jeruslm", + "Asia/Thimbu": "btthi", + "Asia/Thimphu": "btthi", + "Asia/Tokyo": "jptyo", + "Asia/Tomsk": "rutof", + "Asia/Ujung_Pandang": "idmak", + "Asia/Ulaanbaatar": "mnuln", + "Asia/Ulan_Bator": "mnuln", + "Asia/Urumqi": "cnurc", + "Asia/Ust-Nera": "ruunera", + "Asia/Vientiane": "lavte", + "Asia/Vladivostok": "ruvvo", + "Asia/Yakutsk": "ruyks", + "Asia/Yangon": "mmrgn", + "Asia/Yekaterinburg": "ruyek", + "Asia/Yerevan": "amevn", + "Atlantic/Azores": "ptpdl", + "Atlantic/Bermuda": "bmbda", + "Atlantic/Canary": "eslpa", + "Atlantic/Cape_Verde": "cvrai", + "Atlantic/Faeroe": "fotho", + "Atlantic/Faroe": "fotho", + "Atlantic/Jan_Mayen": "sjlyr", + "Atlantic/Madeira": "ptfnc", + "Atlantic/Reykjavik": "isrey", + "Atlantic/South_Georgia": "gsgrv", + "Atlantic/St_Helena": "shshn", + "Atlantic/Stanley": "fkpsy", + "Australia/ACT": "ausyd", + "Australia/Adelaide": "auadl", + "Australia/Brisbane": "aubne", + "Australia/Broken_Hill": "aubhq", + "Australia/Canberra": "ausyd", + "Australia/Currie": "aukns", + "Australia/Darwin": "audrw", + "Australia/Eucla": "aueuc", + "Australia/Hobart": "auhba", + "Australia/LHI": "auldh", + "Australia/Lindeman": "auldc", + "Australia/Lord_Howe": "auldh", + "Australia/Melbourne": "aumel", + "Australia/North": "audrw", + "Australia/NSW": "ausyd", + "Australia/Perth": "auper", + "Australia/Queensland": "aubne", + "Australia/South": "auadl", + "Australia/Sydney": "ausyd", + "Australia/Tasmania": "auhba", + "Australia/Victoria": "aumel", + "Australia/West": "auper", + "Australia/Yancowinna": "aubhq", + "Brazil/Acre": "brrbr", + "Brazil/DeNoronha": "brfen", + "Brazil/East": "brsao", + "Brazil/West": "brmao", + "Canada/Atlantic": "cahal", + "Canada/Central": "cawnp", + "Canada/East-Saskatchewan": "careg", + "Canada/Eastern": "cator", + "Canada/Mountain": "caedm", + "Canada/Newfoundland": "casjf", + "Canada/Pacific": "cavan", + "Canada/Saskatchewan": "careg", + "Canada/Yukon": "cayxy", + "Chile/Continental": "clscl", + "Chile/EasterIsland": "clipc", + "CST6CDT": "cst6cdt", + "Cuba": "cuhav", + "Egypt": "egcai", + "Eire": "iedub", + "EST": "utcw05", + "EST5EDT": "est5edt", + "Etc/GMT": "gmt", + "Etc/GMT+0": "gmt", + "Etc/GMT+1": "utcw01", + "Etc/GMT+10": "utcw10", + "Etc/GMT+11": "utcw11", + "Etc/GMT+12": "utcw12", + "Etc/GMT+2": "utcw02", + "Etc/GMT+3": "utcw03", + "Etc/GMT+4": "utcw04", + "Etc/GMT+5": "utcw05", + "Etc/GMT+6": "utcw06", + "Etc/GMT+7": "utcw07", + "Etc/GMT+8": "utcw08", + "Etc/GMT+9": "utcw09", + "Etc/GMT-0": "gmt", + "Etc/GMT-1": "utce01", + "Etc/GMT-10": "utce10", + "Etc/GMT-11": "utce11", + "Etc/GMT-12": "utce12", + "Etc/GMT-13": "utce13", + "Etc/GMT-14": "utce14", + "Etc/GMT-2": "utce02", + "Etc/GMT-3": "utce03", + "Etc/GMT-4": "utce04", + "Etc/GMT-5": "utce05", + "Etc/GMT-6": "utce06", + "Etc/GMT-7": "utce07", + "Etc/GMT-8": "utce08", + "Etc/GMT-9": "utce09", + "Etc/GMT0": "gmt", + "Etc/Greenwich": "gmt", + "Etc/UCT": "utc", + "Etc/Universal": "utc", + "Etc/Unknown": "unk", + "Etc/UTC": "utc", + "Etc/Zulu": "utc", + "Europe/Amsterdam": "nlams", + "Europe/Andorra": "adalv", + "Europe/Astrakhan": "ruasf", + "Europe/Athens": "grath", + "Europe/Belfast": "gblon", + "Europe/Belgrade": "rsbeg", + "Europe/Berlin": "deber", + "Europe/Bratislava": "skbts", + "Europe/Brussels": "bebru", + "Europe/Bucharest": "robuh", + "Europe/Budapest": "hubud", + "Europe/Busingen": "debsngn", + "Europe/Chisinau": "mdkiv", + "Europe/Copenhagen": "dkcph", + "Europe/Dublin": "iedub", + "Europe/Gibraltar": "gigib", + "Europe/Guernsey": "gggci", + "Europe/Helsinki": "fihel", + "Europe/Isle_of_Man": "imdgs", + "Europe/Istanbul": "trist", + "Europe/Jersey": "jesth", + "Europe/Kaliningrad": "rukgd", + "Europe/Kiev": "uaiev", + "Europe/Kirov": "rukvx", + "Europe/Kyiv": "uaiev", + "Europe/Lisbon": "ptlis", + "Europe/Ljubljana": "silju", + "Europe/London": "gblon", + "Europe/Luxembourg": "lulux", + "Europe/Madrid": "esmad", + "Europe/Malta": "mtmla", + "Europe/Mariehamn": "fimhq", + "Europe/Minsk": "bymsq", + "Europe/Monaco": "mcmon", + "Europe/Moscow": "rumow", + "Europe/Nicosia": "cynic", + "Europe/Oslo": "noosl", + "Europe/Paris": "frpar", + "Europe/Podgorica": "metgd", + "Europe/Prague": "czprg", + "Europe/Riga": "lvrix", + "Europe/Rome": "itrom", + "Europe/Samara": "rukuf", + "Europe/San_Marino": "smsai", + "Europe/Sarajevo": "basjj", + "Europe/Saratov": "rurtw", + "Europe/Simferopol": "uasip", + "Europe/Skopje": "mkskp", + "Europe/Sofia": "bgsof", + "Europe/Stockholm": "sesto", + "Europe/Tallinn": "eetll", + "Europe/Tirane": "altia", + "Europe/Tiraspol": "mdkiv", + "Europe/Ulyanovsk": "ruuly", + "Europe/Uzhgorod": "uauzh", + "Europe/Vaduz": "livdz", + "Europe/Vatican": "vavat", + "Europe/Vienna": "atvie", + "Europe/Vilnius": "ltvno", + "Europe/Volgograd": "ruvog", + "Europe/Warsaw": "plwaw", + "Europe/Zagreb": "hrzag", + "Europe/Zaporozhye": "uaozh", + "Europe/Zurich": "chzrh", + "GB": "gblon", + "GB-Eire": "gblon", + "GMT": "gmt", + "GMT+0": "gmt", + "GMT-0": "gmt", + "GMT0": "gmt", + "Greenwich": "gmt", + "Hongkong": "hkhkg", + "HST": "utcw10", + "Iceland": "isrey", + "Indian/Antananarivo": "mgtnr", + "Indian/Chagos": "iodga", + "Indian/Christmas": "cxxch", + "Indian/Cocos": "cccck", + "Indian/Comoro": "kmyva", + "Indian/Kerguelen": "tfpfr", + "Indian/Mahe": "scmaw", + "Indian/Maldives": "mvmle", + "Indian/Mauritius": "muplu", + "Indian/Mayotte": "ytmam", + "Indian/Reunion": "rereu", + "Iran": "irthr", + "Israel": "jeruslm", + "Jamaica": "jmkin", + "Japan": "jptyo", + "Kwajalein": "mhkwa", + "Libya": "lytip", + "Mexico/BajaNorte": "mxtij", + "Mexico/BajaSur": "mxmzt", + "Mexico/General": "mxmex", + "MST": "utcw07", + "MST7MDT": "mst7mdt", + "Navajo": "usden", + "NZ": "nzakl", + "NZ-CHAT": "nzcht", + "Pacific/Apia": "wsapw", + "Pacific/Auckland": "nzakl", + "Pacific/Bougainville": "pgraw", + "Pacific/Chatham": "nzcht", + "Pacific/Chuuk": "fmtkk", + "Pacific/Easter": "clipc", + "Pacific/Efate": "vuvli", + "Pacific/Enderbury": "kipho", + "Pacific/Fakaofo": "tkfko", + "Pacific/Fiji": "fjsuv", + "Pacific/Funafuti": "tvfun", + "Pacific/Galapagos": "ecgps", + "Pacific/Gambier": "pfgmr", + "Pacific/Guadalcanal": "sbhir", + "Pacific/Guam": "gugum", + "Pacific/Honolulu": "ushnl", + "Pacific/Johnston": "umjon", + "Pacific/Kanton": "kipho", + "Pacific/Kiritimati": "kicxi", + "Pacific/Kosrae": "fmksa", + "Pacific/Kwajalein": "mhkwa", + "Pacific/Majuro": "mhmaj", + "Pacific/Marquesas": "pfnhv", + "Pacific/Midway": "ummdy", + "Pacific/Nauru": "nrinu", + "Pacific/Niue": "nuiue", + "Pacific/Norfolk": "nfnlk", + "Pacific/Noumea": "ncnou", + "Pacific/Pago_Pago": "asppg", + "Pacific/Palau": "pwror", + "Pacific/Pitcairn": "pnpcn", + "Pacific/Pohnpei": "fmpni", + "Pacific/Ponape": "fmpni", + "Pacific/Port_Moresby": "pgpom", + "Pacific/Rarotonga": "ckrar", + "Pacific/Saipan": "mpspn", + "Pacific/Samoa": "asppg", + "Pacific/Tahiti": "pfppt", + "Pacific/Tarawa": "kitrw", + "Pacific/Tongatapu": "totbu", + "Pacific/Truk": "fmtkk", + "Pacific/Wake": "umawk", + "Pacific/Wallis": "wfmau", + "Pacific/Yap": "fmtkk", + "Poland": "plwaw", + "Portugal": "ptlis", + "PRC": "cnsha", + "PST8PDT": "pst8pdt", + "ROC": "twtpe", + "ROK": "krsel", + "Singapore": "sgsin", + "Turkey": "trist", + "UCT": "utc", + "Universal": "utc", + "US/Alaska": "usanc", + "US/Aleutian": "usadk", + "US/Arizona": "usphx", + "US/Central": "uschi", + "US/East-Indiana": "usind", + "US/Eastern": "usnyc", + "US/Hawaii": "ushnl", + "US/Indiana-Starke": "usknx", + "US/Michigan": "usdet", + "US/Mountain": "usden", + "US/Pacific": "uslax", + "US/Pacific-New": "uslax", + "US/Samoa": "asppg", + "UTC": "utc", + "W-SU": "rumow", + "Zulu": "utc" + } +} diff --git a/provider/testdata/data/baked/macros.rs b/provider/testdata/data/baked/macros.rs index 475e59c797e..119bfc71985 100644 --- a/provider/testdata/data/baked/macros.rs +++ b/provider/testdata/data/baked/macros.rs @@ -396,6 +396,8 @@ mod macros { #[macro_use] mod segmenter_word_v1; #[macro_use] + mod time_zone_bcp47_to_iana_v1; + #[macro_use] mod time_zone_exemplar_cities_v1; #[macro_use] mod time_zone_formats_v1; @@ -404,6 +406,8 @@ mod macros { #[macro_use] mod time_zone_generic_short_v1; #[macro_use] + mod time_zone_iana_to_bcp47_v1; + #[macro_use] mod time_zone_metazone_period_v1; #[macro_use] mod time_zone_specific_long_v1; @@ -805,6 +809,8 @@ pub use __impl_segmenter_sentence_v1 as impl_segmenter_sentence_v1; #[doc(inline)] pub use __impl_segmenter_word_v1 as impl_segmenter_word_v1; #[doc(inline)] +pub use __impl_time_zone_bcp47_to_iana_v1 as impl_time_zone_bcp47_to_iana_v1; +#[doc(inline)] pub use __impl_time_zone_exemplar_cities_v1 as impl_time_zone_exemplar_cities_v1; #[doc(inline)] pub use __impl_time_zone_formats_v1 as impl_time_zone_formats_v1; @@ -813,6 +819,8 @@ pub use __impl_time_zone_generic_long_v1 as impl_time_zone_generic_long_v1; #[doc(inline)] pub use __impl_time_zone_generic_short_v1 as impl_time_zone_generic_short_v1; #[doc(inline)] +pub use __impl_time_zone_iana_to_bcp47_v1 as impl_time_zone_iana_to_bcp47_v1; +#[doc(inline)] pub use __impl_time_zone_metazone_period_v1 as impl_time_zone_metazone_period_v1; #[doc(inline)] pub use __impl_time_zone_specific_long_v1 as impl_time_zone_specific_long_v1; @@ -1015,10 +1023,12 @@ use __lookup_segmenter_line_v1 as lookup_segmenter_line_v1; use __lookup_segmenter_lstm_wl_auto_v1 as lookup_segmenter_lstm_wl_auto_v1; use __lookup_segmenter_sentence_v1 as lookup_segmenter_sentence_v1; use __lookup_segmenter_word_v1 as lookup_segmenter_word_v1; +use __lookup_time_zone_bcp47_to_iana_v1 as lookup_time_zone_bcp47_to_iana_v1; use __lookup_time_zone_exemplar_cities_v1 as lookup_time_zone_exemplar_cities_v1; use __lookup_time_zone_formats_v1 as lookup_time_zone_formats_v1; use __lookup_time_zone_generic_long_v1 as lookup_time_zone_generic_long_v1; use __lookup_time_zone_generic_short_v1 as lookup_time_zone_generic_short_v1; +use __lookup_time_zone_iana_to_bcp47_v1 as lookup_time_zone_iana_to_bcp47_v1; use __lookup_time_zone_metazone_period_v1 as lookup_time_zone_metazone_period_v1; use __lookup_time_zone_specific_long_v1 as lookup_time_zone_specific_long_v1; use __lookup_time_zone_specific_short_v1 as lookup_time_zone_specific_short_v1; @@ -1289,6 +1299,10 @@ pub use __singleton_segmenter_sentence_v1 as singleton_segmenter_sentence_v1; #[doc(inline)] pub use __singleton_segmenter_word_v1 as singleton_segmenter_word_v1; #[doc(inline)] +pub use __singleton_time_zone_bcp47_to_iana_v1 as singleton_time_zone_bcp47_to_iana_v1; +#[doc(inline)] +pub use __singleton_time_zone_iana_to_bcp47_v1 as singleton_time_zone_iana_to_bcp47_v1; +#[doc(inline)] pub use __singleton_time_zone_metazone_period_v1 as singleton_time_zone_metazone_period_v1; /// Implement [`DataProvider`](icu_provider::DataProvider) on the given struct using the data /// hardcoded in this file. This allows the struct to be used with @@ -1693,6 +1707,8 @@ macro_rules! __impl_data_provider { impl_segmenter_sentence_v1!($provider); #[cfg(feature = "icu_segmenter")] impl_segmenter_word_v1!($provider); + #[cfg(feature = "icu_timezone")] + impl_time_zone_bcp47_to_iana_v1!($provider); #[cfg(feature = "icu_datetime")] impl_time_zone_exemplar_cities_v1!($provider); #[cfg(feature = "icu_datetime")] @@ -1702,6 +1718,8 @@ macro_rules! __impl_data_provider { #[cfg(feature = "icu_datetime")] impl_time_zone_generic_short_v1!($provider); #[cfg(feature = "icu_timezone")] + impl_time_zone_iana_to_bcp47_v1!($provider); + #[cfg(feature = "icu_timezone")] impl_time_zone_metazone_period_v1!($provider); #[cfg(feature = "icu_datetime")] impl_time_zone_specific_long_v1!($provider); @@ -2117,6 +2135,8 @@ macro_rules! __impl_any_provider { const SEGMENTER_SENTENCE_V1: icu_provider::DataKeyHash = ::KEY.hashed(); #[cfg(feature = "icu_segmenter")] const SEGMENTER_WORD_V1: icu_provider::DataKeyHash = ::KEY.hashed(); + #[cfg(feature = "icu_timezone")] + const TIME_ZONE_BCP47_TO_IANA_V1: icu_provider::DataKeyHash = ::KEY.hashed(); #[cfg(feature = "icu_datetime")] const TIME_ZONE_EXEMPLAR_CITIES_V1: icu_provider::DataKeyHash = ::KEY.hashed(); #[cfg(feature = "icu_datetime")] @@ -2126,6 +2146,8 @@ macro_rules! __impl_any_provider { #[cfg(feature = "icu_datetime")] const TIME_ZONE_GENERIC_SHORT_V1: icu_provider::DataKeyHash = ::KEY.hashed(); #[cfg(feature = "icu_timezone")] + const TIME_ZONE_IANA_TO_BCP47_V1: icu_provider::DataKeyHash = ::KEY.hashed(); + #[cfg(feature = "icu_timezone")] const TIME_ZONE_METAZONE_PERIOD_V1: icu_provider::DataKeyHash = ::KEY.hashed(); #[cfg(feature = "icu_datetime")] const TIME_ZONE_SPECIFIC_LONG_V1: icu_provider::DataKeyHash = ::KEY.hashed(); @@ -2522,6 +2544,8 @@ macro_rules! __impl_any_provider { SEGMENTER_SENTENCE_V1 => lookup_segmenter_sentence_v1!(req.locale).map(icu_provider::AnyPayload::from_static_ref), #[cfg(feature = "icu_segmenter")] SEGMENTER_WORD_V1 => lookup_segmenter_word_v1!(req.locale).map(icu_provider::AnyPayload::from_static_ref), + #[cfg(feature = "icu_timezone")] + TIME_ZONE_BCP47_TO_IANA_V1 => lookup_time_zone_bcp47_to_iana_v1!(req.locale).map(icu_provider::AnyPayload::from_static_ref), #[cfg(feature = "icu_datetime")] TIME_ZONE_EXEMPLAR_CITIES_V1 => lookup_time_zone_exemplar_cities_v1!(req.locale).map(icu_provider::AnyPayload::from_static_ref), #[cfg(feature = "icu_datetime")] @@ -2531,6 +2555,8 @@ macro_rules! __impl_any_provider { #[cfg(feature = "icu_datetime")] TIME_ZONE_GENERIC_SHORT_V1 => lookup_time_zone_generic_short_v1!(req.locale).map(icu_provider::AnyPayload::from_static_ref), #[cfg(feature = "icu_timezone")] + TIME_ZONE_IANA_TO_BCP47_V1 => lookup_time_zone_iana_to_bcp47_v1!(req.locale).map(icu_provider::AnyPayload::from_static_ref), + #[cfg(feature = "icu_timezone")] TIME_ZONE_METAZONE_PERIOD_V1 => lookup_time_zone_metazone_period_v1!(req.locale).map(icu_provider::AnyPayload::from_static_ref), #[cfg(feature = "icu_datetime")] TIME_ZONE_SPECIFIC_LONG_V1 => lookup_time_zone_specific_long_v1!(req.locale).map(icu_provider::AnyPayload::from_static_ref), diff --git a/provider/testdata/data/baked/macros/time_zone_bcp47_to_iana_v1.rs b/provider/testdata/data/baked/macros/time_zone_bcp47_to_iana_v1.rs new file mode 100644 index 00000000000..bb4f9c75337 --- /dev/null +++ b/provider/testdata/data/baked/macros/time_zone_bcp47_to_iana_v1.rs @@ -0,0 +1,43 @@ +// @generated +#[doc(hidden)] +#[macro_export] +macro_rules! __singleton_time_zone_bcp47_to_iana_v1 { + () => { + icu_timezone::provider::names::Bcp47ToIanaMapV1 { + map: unsafe { + #[allow(unused_unsafe)] + zerovec::ZeroMap::from_parts_unchecked(unsafe { zerovec::ZeroVec::from_bytes_unchecked(b"adalv\0\0\0aedxb\0\0\0afkbl\0\0\0aganu\0\0\0aiaxa\0\0\0altia\0\0\0amevn\0\0\0ancur\0\0\0aolad\0\0\0aqcas\0\0\0aqdav\0\0\0aqddu\0\0\0aqmaw\0\0\0aqmcm\0\0\0aqplm\0\0\0aqrot\0\0\0aqsyw\0\0\0aqtrl\0\0\0aqvos\0\0\0arbue\0\0\0arcor\0\0\0arctc\0\0\0arirj\0\0\0arjuj\0\0\0arluq\0\0\0armdz\0\0\0arrgl\0\0\0arsla\0\0\0artuc\0\0\0aruaq\0\0\0arush\0\0\0asppg\0\0\0atvie\0\0\0auadl\0\0\0aubhq\0\0\0aubne\0\0\0audrw\0\0\0aueuc\0\0\0auhba\0\0\0aukns\0\0\0auldc\0\0\0auldh\0\0\0aumel\0\0\0aumqi\0\0\0auper\0\0\0ausyd\0\0\0awaua\0\0\0azbak\0\0\0basjj\0\0\0bbbgi\0\0\0bddac\0\0\0bebru\0\0\0bfoua\0\0\0bgsof\0\0\0bhbah\0\0\0bibjm\0\0\0bjptn\0\0\0bmbda\0\0\0bnbwn\0\0\0bolpb\0\0\0bqkra\0\0\0braux\0\0\0brbel\0\0\0brbvb\0\0\0brcgb\0\0\0brcgr\0\0\0brern\0\0\0brfen\0\0\0brfor\0\0\0brmao\0\0\0brmcz\0\0\0brpvh\0\0\0brrbr\0\0\0brrec\0\0\0brsao\0\0\0brssa\0\0\0brstm\0\0\0bsnas\0\0\0btthi\0\0\0bwgbe\0\0\0bymsq\0\0\0bzbze\0\0\0cacfq\0\0\0caedm\0\0\0caffs\0\0\0cafne\0\0\0caglb\0\0\0cagoo\0\0\0cahal\0\0\0caiql\0\0\0camon\0\0\0canpg\0\0\0capnt\0\0\0careb\0\0\0careg\0\0\0casjf\0\0\0cathu\0\0\0cator\0\0\0cavan\0\0\0cawnp\0\0\0caybx\0\0\0caycb\0\0\0cayda\0\0\0caydq\0\0\0cayek\0\0\0cayev\0\0\0cayxy\0\0\0cayyn\0\0\0cayzf\0\0\0cayzs\0\0\0cccck\0\0\0cdfbm\0\0\0cdfih\0\0\0cfbgf\0\0\0cgbzv\0\0\0chzrh\0\0\0ciabj\0\0\0ckrar\0\0\0clipc\0\0\0clpuq\0\0\0clscl\0\0\0cmdla\0\0\0cnsha\0\0\0cnurc\0\0\0cobog\0\0\0crsjo\0\0\0cst6cdt\0cuhav\0\0\0cvrai\0\0\0cxxch\0\0\0cyfmg\0\0\0cynic\0\0\0czprg\0\0\0deber\0\0\0debsngn\0djjib\0\0\0dkcph\0\0\0dmdom\0\0\0dosdq\0\0\0dzalg\0\0\0ecgps\0\0\0ecgye\0\0\0eetll\0\0\0egcai\0\0\0eheai\0\0\0erasm\0\0\0esceu\0\0\0eslpa\0\0\0esmad\0\0\0est5edt\0etadd\0\0\0fihel\0\0\0fimhq\0\0\0fjsuv\0\0\0fkpsy\0\0\0fmksa\0\0\0fmpni\0\0\0fmtkk\0\0\0fotho\0\0\0frpar\0\0\0galbv\0\0\0gazastrpgblon\0\0\0gdgnd\0\0\0getbs\0\0\0gfcay\0\0\0gggci\0\0\0ghacc\0\0\0gigib\0\0\0gldkshvnglgoh\0\0\0globy\0\0\0glthu\0\0\0gmbjl\0\0\0gmt\0\0\0\0\0gncky\0\0\0gpbbr\0\0\0gpmsb\0\0\0gpsbh\0\0\0gqssg\0\0\0grath\0\0\0gsgrv\0\0\0gtgua\0\0\0gugum\0\0\0gwoxb\0\0\0gygeo\0\0\0hebron\0\0hkhkg\0\0\0hntgu\0\0\0hrzag\0\0\0htpap\0\0\0hubud\0\0\0iddjj\0\0\0idjkt\0\0\0idmak\0\0\0idpnk\0\0\0iedub\0\0\0imdgs\0\0\0inccu\0\0\0iodga\0\0\0iqbgw\0\0\0irthr\0\0\0isrey\0\0\0itrom\0\0\0jeruslm\0jesth\0\0\0jmkin\0\0\0joamm\0\0\0jptyo\0\0\0kenbo\0\0\0kgfru\0\0\0khpnh\0\0\0kicxi\0\0\0kipho\0\0\0kitrw\0\0\0kmyva\0\0\0knbas\0\0\0kpfnj\0\0\0krsel\0\0\0kwkwi\0\0\0kygec\0\0\0kzaau\0\0\0kzakx\0\0\0kzala\0\0\0kzguw\0\0\0kzksn\0\0\0kzkzo\0\0\0kzura\0\0\0lavte\0\0\0lbbey\0\0\0lccas\0\0\0livdz\0\0\0lkcmb\0\0\0lrmlw\0\0\0lsmsu\0\0\0ltvno\0\0\0lulux\0\0\0lvrix\0\0\0lytip\0\0\0macas\0\0\0mcmon\0\0\0mdkiv\0\0\0metgd\0\0\0mgtnr\0\0\0mhkwa\0\0\0mhmaj\0\0\0mkskp\0\0\0mlbko\0\0\0mmrgn\0\0\0mncoq\0\0\0mnhvd\0\0\0mnuln\0\0\0momfm\0\0\0mpspn\0\0\0mqfdf\0\0\0mrnkc\0\0\0msmni\0\0\0mst7mdt\0mtmla\0\0\0muplu\0\0\0mvmle\0\0\0mwblz\0\0\0mxchi\0\0\0mxcjs\0\0\0mxcun\0\0\0mxhmo\0\0\0mxmam\0\0\0mxmex\0\0\0mxmid\0\0\0mxmty\0\0\0mxmzt\0\0\0mxoji\0\0\0mxpvr\0\0\0mxstis\0\0mxtij\0\0\0mykch\0\0\0mykul\0\0\0mzmpm\0\0\0nawdh\0\0\0ncnou\0\0\0nenim\0\0\0nfnlk\0\0\0nglos\0\0\0nimga\0\0\0nlams\0\0\0noosl\0\0\0npktm\0\0\0nrinu\0\0\0nuiue\0\0\0nzakl\0\0\0nzcht\0\0\0ommct\0\0\0papty\0\0\0pelim\0\0\0pfgmr\0\0\0pfnhv\0\0\0pfppt\0\0\0pgpom\0\0\0pgraw\0\0\0phmnl\0\0\0pkkhi\0\0\0plwaw\0\0\0pmmqc\0\0\0pnpcn\0\0\0prsju\0\0\0pst8pdt\0ptfnc\0\0\0ptlis\0\0\0ptpdl\0\0\0pwror\0\0\0pyasu\0\0\0qadoh\0\0\0rereu\0\0\0robuh\0\0\0rsbeg\0\0\0ruasf\0\0\0rubax\0\0\0ruchita\0rudyr\0\0\0rugdx\0\0\0ruikt\0\0\0rukgd\0\0\0rukhndg\0rukra\0\0\0rukuf\0\0\0rukvx\0\0\0rumow\0\0\0runoz\0\0\0ruoms\0\0\0ruovb\0\0\0rupkc\0\0\0rurtw\0\0\0rusred\0\0rutof\0\0\0ruuly\0\0\0ruunera\0ruuus\0\0\0ruvog\0\0\0ruvvo\0\0\0ruyek\0\0\0ruyks\0\0\0rwkgl\0\0\0saruh\0\0\0sbhir\0\0\0scmaw\0\0\0sdkrt\0\0\0sesto\0\0\0sgsin\0\0\0shshn\0\0\0silju\0\0\0sjlyr\0\0\0skbts\0\0\0slfna\0\0\0smsai\0\0\0sndkr\0\0\0somgq\0\0\0srpbm\0\0\0ssjub\0\0\0sttms\0\0\0svsal\0\0\0sxphi\0\0\0sydam\0\0\0szqmn\0\0\0tcgdt\0\0\0tdndj\0\0\0tfpfr\0\0\0tglfw\0\0\0thbkk\0\0\0tjdyu\0\0\0tkfko\0\0\0tldil\0\0\0tmasb\0\0\0tntun\0\0\0totbu\0\0\0trist\0\0\0ttpos\0\0\0tvfun\0\0\0twtpe\0\0\0tzdar\0\0\0uaiev\0\0\0uaozh\0\0\0uasip\0\0\0uauzh\0\0\0ugkla\0\0\0umawk\0\0\0umjon\0\0\0ummdy\0\0\0unk\0\0\0\0\0usadk\0\0\0usaeg\0\0\0usanc\0\0\0usboi\0\0\0uschi\0\0\0usden\0\0\0usdet\0\0\0ushnl\0\0\0usind\0\0\0usinvev\0usjnu\0\0\0usknx\0\0\0uslax\0\0\0uslui\0\0\0usmnm\0\0\0usmoc\0\0\0usmtm\0\0\0usndcnt\0usndnsl\0usnyc\0\0\0usoea\0\0\0usome\0\0\0usphx\0\0\0ussit\0\0\0ustel\0\0\0uswlz\0\0\0uswsq\0\0\0usxul\0\0\0usyak\0\0\0utc\0\0\0\0\0utce01\0\0utce02\0\0utce03\0\0utce04\0\0utce05\0\0utce06\0\0utce07\0\0utce08\0\0utce09\0\0utce10\0\0utce11\0\0utce12\0\0utce13\0\0utce14\0\0utcw01\0\0utcw02\0\0utcw03\0\0utcw04\0\0utcw05\0\0utcw06\0\0utcw07\0\0utcw08\0\0utcw09\0\0utcw10\0\0utcw11\0\0utcw12\0\0uymvd\0\0\0uzskd\0\0\0uztas\0\0\0vavat\0\0\0vcsvd\0\0\0veccs\0\0\0vgtov\0\0\0vistt\0\0\0vnsgn\0\0\0vuvli\0\0\0wfmau\0\0\0wsapw\0\0\0yeade\0\0\0ytmam\0\0\0zajnb\0\0\0zmlun\0\0\0zwhre\0\0\0") }, unsafe { zerovec::VarZeroVec::from_bytes_unchecked(b"\xCD\x01\0\0\0\0\x0E\0\x18\0\"\x001\0A\0N\0Z\0i\0v\0\x86\0\x96\0\xAF\0\xC0\0\xD2\0\xE3\0\xF5\0\x05\x01\x15\x01&\x01:\x01I\x01Z\x01t\x01\x81\x01\x9B\x01\xAA\x01\xC8\x01\xDF\x01\xF8\x01\x12\x02+\x023\x02@\x02O\x02c\x02w\x02\x86\x02\x95\x02\xA7\x02\xB7\x02\xC9\x02\xDC\x02\xEE\x02\x02\x03\x10\x03 \x03-\x036\x03E\x03U\x03_\x03n\x03\x80\x03\x8C\x03\x98\x03\xA8\x03\xB9\x03\xC9\x03\xD4\x03\xE2\x03\xF4\x03\x05\x04\x12\x04#\x041\x04E\x04U\x04e\x04v\x04\x81\x04\x8F\x04\xA2\x04\xAD\x04\xBB\x04\xC6\x04\xD3\x04\xE3\x04\xF1\x04\xFD\x04\x0C\x05\x18\x05&\x055\x05D\x05W\x05j\x05{\x05\x8C\x05\x9B\x05\xAA\x05\xB9\x05\xC8\x05\xDB\x05\xEB\x05\xFE\x05\x11\x06$\x062\x06@\x06N\x06b\x06w\x06\x85\x06\x99\x06\xAD\x06\xBB\x06\xC7\x06\xDC\x06\xEF\x06\x04\x07\x10\x07!\x070\x07=\x07O\x07\\\x07j\x07{\x07\x89\x07\x9D\x07\xAE\x07\xBB\x07\xBE\x07\xC9\x07\xD7\x07\xE9\x07\xF0\x07\xF4\x07\x07\x08\x17\x08%\x083\x08@\x08M\x08\\\x08k\x08|\x08\x8C\x08\xA1\x08\xAF\x08\xC0\x08\xD1\x08\xDF\x08\xE4\x08\xF3\x08\0\t\x0C\t\x1B\t(\t/\tA\tP\t`\tl\t|\t\x8A\t\x98\t\xA3\t\xB1\t\xBD\t\xCE\t\xD7\t\xDE\t\xED\t\xF9\t\x08\n\x17\n#\n3\nG\nS\ng\nt\n\x81\n\x8A\n\x98\n\xAA\n\xB9\n\xCE\n\xDB\n\xE8\n\xFE\n\x0F\x0B\x1B\x0B(\x0B6\x0BA\x0BI\x0B\\\x0Bi\x0B\x7F\x0B\x8E\x0B\x9B\x0B\xA7\x0B\xB9\x0B\xC7\x0B\xD4\x0B\xE6\x0B\xF2\x0B\xFF\x0B\x0B\x0C\x0F\x0C\x16\x0C!\x0C'\x0C4\x0C;\x0CE\x0CJ\x0CX\x0Cd\x0Cs\x0C\x85\x0C\x93\x0C\xA1\x0C\xAE\x0C\xBE\x0C\xCC\x0C\xCF\x0C\xDA\x0C\xE8\x0C\xF2\x0C\xFD\x0C\x08\r\x13\r \r.\r7\rE\rP\r`\rl\rx\r\x87\r\x94\r\xA2\r\xB3\r\xBE\r\xC3\r\xD4\r\xE1\r\xF0\r\0\x0E\x13\x0E$\x0E2\x0E?\x0EN\x0EY\x0Eh\x0Eq\x0E\x80\x0E\x8A\x0E\x98\x0E\xAA\x0E\xBB\x0E\xCD\x0E\xD4\x0E\xE0\x0E\xF0\x0E\xFF\x0E\x0E\x0F\x1F\x0F4\x0FB\x0FT\x0Fe\x0Fs\x0F\x81\x0F\x92\x0F\xA0\x0F\xAF\x0F\xC5\x0F\xD9\x0F\xE9\x0F\xF5\x0F\x06\x10\x13\x10\"\x100\x10=\x10L\x10X\x10g\x10w\x10\x82\x10\x8F\x10\x9C\x10\xA8\x10\xB8\x10\xC7\x10\xD2\x10\xE0\x10\xEC\x10\xFB\x10\x0C\x11\x1A\x11.\x11B\x11M\x11Y\x11_\x11o\x11\x7F\x11\x92\x11\x99\x11\xA9\x11\xB1\x11\xC0\x11\xCD\x11\xDD\x11\xE7\x11\xF5\x11\x05\x12\x14\x12$\x120\x12:\x12E\x12Q\x12]\x12o\x12|\x12\x8C\x12\x99\x12\xA5\x12\xA9\x12\xBA\x12\xC3\x12\xD3\x12\xE1\x12\xEF\x12\x01\x13\x0B\x13\x1B\x13(\x135\x13E\x13U\x13g\x13s\x13\x80\x13\x8B\x13\x9E\x13\xA9\x13\xB8\x13\xC8\x13\xD1\x13\xE3\x13\xF3\x13\x05\x14\x16\x14%\x146\x14B\x14R\x14d\x14o\x14~\x14\x91\x14\xA6\x14\xB3\x14\xC1\x14\xD3\x14\xE2\x14\xF2\x14\xFD\x14\t\x15\x16\x15%\x15.\x15<\x15H\x15Y\x15_\x15t\x15\x84\x15\x87\x15\x9B\x15\xA6\x15\xB7\x15\xC8\x15\xD7\x15\xE5\x15\xF1\x15\x01\x16\x0F\x16\x1A\x16%\x16<\x16E\x16R\x16\\\x16g\x16r\x16{\x16\x8A\x16\x9F\x16\xAD\x16\xBE\x16\xCC\x16\xDE\x16\xEF\x16\n\x17\x1C\x177\x17U\x17_\x17x\x17\x84\x17\x8E\x17\x9B\x17\xB4\x17\xCB\x17\xE5\x17\0\x18\x0F\x18\x13\x18\x1C\x18%\x18.\x187\x18@\x18I\x18R\x18[\x18d\x18n\x18x\x18\x82\x18\x8C\x18\x96\x18\x9F\x18\xA8\x18\xB1\x18\xBA\x18\xC3\x18\xCC\x18\xCF\x18\xD8\x18\xE1\x18\xE4\x18\xEE\x18\xF8\x18\n\x19\x18\x19%\x193\x19E\x19T\x19c\x19q\x19|\x19\x89\x19\x97\x19\xA3\x19\xAC\x19\xBA\x19\xCD\x19\xDA\x19Europe/AndorraAsia/DubaiAsia/KabulAmerica/AntiguaAmerica/AnguillaEurope/TiraneAsia/YerevanAmerica/CuracaoAfrica/LuandaAntarctica/CaseyAntarctica/DavisAntarctica/DumontDUrvilleAntarctica/MawsonAntarctica/McMurdoAntarctica/PalmerAntarctica/RotheraAntarctica/SyowaAntarctica/TrollAntarctica/VostokAmerica/Buenos_AiresAmerica/RosarioAmerica/CatamarcaAmerica/Argentina/La_RiojaAmerica/JujuyAmerica/Argentina/San_LuisAmerica/MendozaAmerica/Argentina/Rio_GallegosAmerica/Argentina/SaltaAmerica/Argentina/TucumanAmerica/Argentina/San_JuanAmerica/Argentina/UshuaiaUS/SamoaEurope/ViennaAustralia/SouthAustralia/YancowinnaAustralia/QueenslandAustralia/NorthAustralia/EuclaAustralia/TasmaniaAustralia/CurrieAustralia/LindemanAustralia/Lord_HoweAustralia/VictoriaAntarctica/MacquarieAustralia/WestAustralia/SydneyAmerica/ArubaAsia/BakuEurope/SarajevoAmerica/BarbadosAsia/DhakaEurope/BrusselsAfrica/OuagadougouEurope/SofiaAsia/BahrainAfrica/BujumburaAfrica/Porto-NovoAtlantic/BermudaAsia/BruneiAmerica/La_PazAmerica/KralendijkAmerica/AraguainaAmerica/BelemAmerica/Boa_VistaAmerica/CuiabaAmerica/Campo_GrandeAmerica/EirunepeBrazil/DeNoronhaAmerica/FortalezaBrazil/WestAmerica/MaceioAmerica/Porto_VelhoBrazil/AcreAmerica/RecifeBrazil/EastAmerica/BahiaAmerica/SantaremAmerica/NassauAsia/ThimphuAfrica/GaboroneEurope/MinskAmerica/BelizeAmerica/CrestonCanada/MountainAmerica/Rainy_RiverAmerica/Fort_NelsonAmerica/Glace_BayAmerica/Goose_BayCanada/AtlanticAmerica/IqaluitAmerica/MonctonAmerica/NipigonAmerica/PangnirtungAmerica/ResoluteCanada/SaskatchewanCanada/NewfoundlandAmerica/Thunder_BayCanada/EasternCanada/PacificCanada/CentralAmerica/Blanc-SablonAmerica/Cambridge_BayAmerica/DawsonAmerica/Dawson_CreekAmerica/Rankin_InletAmerica/InuvikCanada/YukonAmerica/Swift_CurrentAmerica/YellowknifeAmerica/Coral_HarbourIndian/CocosAfrica/LubumbashiAfrica/KinshasaAfrica/BanguiAfrica/BrazzavilleEurope/ZurichAfrica/AbidjanPacific/RarotongaPacific/EasterAmerica/Punta_ArenasChile/ContinentalAfrica/DoualaPRCAsia/UrumqiAmerica/BogotaAmerica/Costa_RicaCST6CDTCubaAtlantic/Cape_VerdeIndian/ChristmasAsia/FamagustaEurope/NicosiaEurope/PragueEurope/BerlinEurope/BusingenAfrica/DjiboutiEurope/CopenhagenAmerica/DominicaAmerica/Santo_DomingoAfrica/AlgiersPacific/GalapagosAmerica/GuayaquilEurope/TallinnEgyptAfrica/El_AaiunAfrica/AsmeraAfrica/CeutaAtlantic/CanaryEurope/MadridEST5EDTAfrica/Addis_AbabaEurope/HelsinkiEurope/MariehamnPacific/FijiAtlantic/StanleyPacific/KosraePacific/PonapePacific/YapAtlantic/FaroeEurope/ParisAfrica/LibrevilleAsia/GazaGB-EireAmerica/GrenadaAsia/TbilisiAmerica/CayenneEurope/GuernseyAfrica/AccraEurope/GibraltarAmerica/DanmarkshavnAmerica/NuukAmerica/ScoresbysundAmerica/ThuleAfrica/BanjulGreenwichAfrica/ConakryAmerica/GuadeloupeAmerica/MarigotAmerica/St_BarthelemyAfrica/MalaboEurope/AthensAtlantic/South_GeorgiaAmerica/GuatemalaPacific/GuamAfrica/BissauAmerica/GuyanaAsia/HebronHongkongAmerica/TegucigalpaEurope/ZagrebAmerica/Port-au-PrinceEurope/BudapestAsia/JayapuraAsia/JakartaAsia/Ujung_PandangAsia/PontianakEurope/DublinEurope/Isle_of_ManAsia/KolkataIndian/ChagosAsia/BaghdadIranIcelandEurope/RomeIsraelEurope/JerseyJamaicaAsia/AmmanJapanAfrica/NairobiAsia/BishkekAsia/Phnom_PenhPacific/KiritimatiPacific/KantonPacific/TarawaIndian/ComoroAmerica/St_KittsAsia/PyongyangROKAsia/KuwaitAmerica/CaymanAsia/AqtauAsia/AqtobeAsia/AlmatyAsia/AtyrauAsia/QostanayAsia/QyzylordaAsia/OralAsia/VientianeAsia/BeirutAmerica/St_LuciaEurope/VaduzAsia/ColomboAfrica/MonroviaAfrica/MaseruEurope/VilniusEurope/LuxembourgEurope/RigaLibyaAfrica/CasablancaEurope/MonacoEurope/TiraspolEurope/PodgoricaIndian/AntananarivoPacific/KwajaleinPacific/MajuroEurope/SkopjeAfrica/TimbuktuAsia/YangonAsia/ChoibalsanAsia/HovdAsia/Ulan_BatorAsia/MacauPacific/SaipanAmerica/MartiniqueAfrica/NouakchottAmerica/MontserratMST7MDTEurope/MaltaIndian/MauritiusIndian/MaldivesAfrica/BlantyreAmerica/ChihuahuaAmerica/Ciudad_JuarezAmerica/CancunAmerica/HermosilloAmerica/MatamorosMexico/GeneralAmerica/MeridaAmerica/MonterreyMexico/BajaSurAmerica/OjinagaAmerica/Bahia_BanderasAmerica/Santa_IsabelMexico/BajaNorteAsia/KuchingAsia/Kuala_LumpurAfrica/MaputoAfrica/WindhoekPacific/NoumeaAfrica/NiameyPacific/NorfolkAfrica/LagosAmerica/ManaguaEurope/AmsterdamEurope/OsloAsia/KatmanduPacific/NauruPacific/NiuePacific/AucklandPacific/ChathamAsia/MuscatAmerica/PanamaAmerica/LimaPacific/GambierPacific/MarquesasPacific/TahitiPacific/Port_MoresbyPacific/BougainvilleAsia/ManilaAsia/KarachiPolandAmerica/MiquelonPacific/PitcairnAmerica/Puerto_RicoPST8PDTAtlantic/MadeiraPortugalAtlantic/AzoresPacific/PalauAmerica/AsuncionAsia/QatarIndian/ReunionEurope/BucharestEurope/BelgradeEurope/AstrakhanAsia/BarnaulAsia/ChitaAsia/AnadyrAsia/MagadanAsia/IrkutskEurope/KaliningradAsia/KhandygaAsia/KrasnoyarskEurope/SamaraEurope/KirovW-SUAsia/NovokuznetskAsia/OmskAsia/NovosibirskAsia/KamchatkaEurope/SaratovAsia/SrednekolymskAsia/TomskEurope/UlyanovskAsia/Ust-NeraAsia/SakhalinEurope/VolgogradAsia/VladivostokAsia/YekaterinburgAsia/YakutskAfrica/KigaliAsia/RiyadhPacific/GuadalcanalIndian/MaheAfrica/KhartoumEurope/StockholmSingaporeAtlantic/St_HelenaEurope/LjubljanaAtlantic/Jan_MayenEurope/BratislavaAfrica/FreetownEurope/San_MarinoAfrica/DakarAfrica/MogadishuAmerica/ParamariboAfrica/JubaAfrica/Sao_TomeAmerica/El_SalvadorAmerica/Lower_PrincesAsia/DamascusAfrica/MbabaneAmerica/Grand_TurkAfrica/NdjamenaIndian/KerguelenAfrica/LomeAsia/BangkokAsia/DushanbePacific/FakaofoAsia/DiliAsia/AshkhabadAfrica/TunisPacific/TongatapuTurkeyAmerica/Port_of_SpainPacific/FunafutiROCAfrica/Dar_es_SalaamEurope/KyivEurope/ZaporozhyeEurope/SimferopolEurope/UzhgorodAfrica/KampalaPacific/WakePacific/JohnstonPacific/MidwayEtc/UnknownUS/AleutianAmerica/Indiana/MarengoUS/AlaskaAmerica/BoiseUS/CentralUS/MountainUS/MichiganUS/HawaiiUS/East-IndianaAmerica/Indiana/VevayAmerica/JuneauUS/Indiana-StarkeUS/Pacific-NewAmerica/LouisvilleAmerica/MenomineeAmerica/Kentucky/MonticelloAmerica/MetlakatlaAmerica/North_Dakota/CenterAmerica/North_Dakota/New_SalemUS/EasternAmerica/Indiana/VincennesAmerica/NomeUS/ArizonaAmerica/SitkaAmerica/Indiana/Tell_CityAmerica/Indiana/WinamacAmerica/Indiana/PetersburgAmerica/North_Dakota/BeulahAmerica/YakutatZuluEtc/GMT-1Etc/GMT-2Etc/GMT-3Etc/GMT-4Etc/GMT-5Etc/GMT-6Etc/GMT-7Etc/GMT-8Etc/GMT-9Etc/GMT-10Etc/GMT-11Etc/GMT-12Etc/GMT-13Etc/GMT-14Etc/GMT+1Etc/GMT+2Etc/GMT+3Etc/GMT+4Etc/GMT+5Etc/GMT+6MSTEtc/GMT+8Etc/GMT+9HSTEtc/GMT+11Etc/GMT+12America/MontevideoAsia/SamarkandAsia/TashkentEurope/VaticanAmerica/St_VincentAmerica/CaracasAmerica/TortolaAmerica/VirginAsia/SaigonPacific/EfatePacific/WallisPacific/ApiaAsia/AdenIndian/MayotteAfrica/JohannesburgAfrica/LusakaAfrica/Harare") }) + }, + } + }; +} +#[doc(hidden)] +#[macro_export] +macro_rules! __lookup_time_zone_bcp47_to_iana_v1 { + ($ locale : expr) => {{ + static SINGLETON: ::Yokeable = singleton_time_zone_bcp47_to_iana_v1!(); + if $locale.is_empty() { + Ok(&SINGLETON) + } else { + Err(icu_provider::DataErrorKind::ExtraneousLocale) + } + }}; +} +/// Implement [`DataProvider`](icu_provider::DataProvider) on the given struct using the data +/// hardcoded in this file. This allows the struct to be used with +/// `icu`'s `_unstable` constructors. +#[doc(hidden)] +#[macro_export] +macro_rules! __impl_time_zone_bcp47_to_iana_v1 { + ($ provider : path) => { + #[clippy::msrv = "1.61"] + impl icu_provider::DataProvider for $provider { + fn load(&self, req: icu_provider::DataRequest) -> Result, icu_provider::DataError> { + match lookup_time_zone_bcp47_to_iana_v1!(req.locale) { + Ok(payload) => Ok(icu_provider::DataResponse { metadata: Default::default(), payload: Some(icu_provider::DataPayload::from_owned(icu_provider::prelude::zerofrom::ZeroFrom::zero_from(payload))) }), + Err(e) => Err(e.with_req(::KEY, req)), + } + } + } + }; +} diff --git a/provider/testdata/data/baked/macros/time_zone_iana_to_bcp47_v1.rs b/provider/testdata/data/baked/macros/time_zone_iana_to_bcp47_v1.rs new file mode 100644 index 00000000000..2bd0bbfe500 --- /dev/null +++ b/provider/testdata/data/baked/macros/time_zone_iana_to_bcp47_v1.rs @@ -0,0 +1,43 @@ +// @generated +#[doc(hidden)] +#[macro_export] +macro_rules! __singleton_time_zone_iana_to_bcp47_v1 { + () => { + icu_timezone::provider::names::IanaToBcp47MapV1 { + map: unsafe { + #[allow(unused_unsafe)] + zerovec::ZeroMap::from_parts_unchecked(unsafe { zerovec::VarZeroVec::from_bytes_unchecked(b"S\x02\0\0\0\0\x0E\0\x1A\0,\0:\0G\0T\0a\0n\0{\0\x88\0\x97\0\xA9\0\xB9\0\xC5\0\xD6\0\xE2\0\xF0\0\xFC\0\x10\x01\x1F\x01,\x01;\x01J\x01Y\x01f\x01y\x01\x84\x01\x92\x01\xA1\x01\xAE\x01\xBD\x01\xC9\x01\xDA\x01\xE5\x01\xF2\x01\x03\x02\x10\x02\x1D\x02*\x027\x02E\x02U\x02d\x02r\x02\x81\x02\x8E\x02\x9F\x02\xB1\x02\xC2\x02\xD1\x02\xE0\x02\xEE\x02\xFA\x02\t\x03\x15\x03&\x036\x03E\x03V\x03t\x03\x8F\x03\xAF\x03\xC8\x03\xDF\x03\xF9\x03\x12\x040\x04G\x04a\x04{\x04\x94\x04\xAD\x04\xBA\x04\xCA\x04\xDA\x04\xE6\x04\xF3\x04\t\x05\x19\x05&\x054\x05H\x05Y\x05g\x05t\x05\x88\x05\x9D\x05\xB1\x05\xBF\x05\xCE\x05\xDF\x05\xEE\x05\xFC\x05\x0B\x06\x1C\x061\x06F\x06U\x06g\x06v\x06\x84\x06\x93\x06\xA7\x06\xB5\x06\xC9\x06\xD7\x06\xE6\x06\xF6\x06\x06\x07\x16\x07)\x079\x07L\x07^\x07o\x07\x80\x07\x8F\x07\xA0\x07\xB2\x07\xC1\x07\xD3\x07\xE4\x07\xF5\x07\x03\x08\x12\x08 \x082\x08N\x08b\x08y\x08\x93\x08\xAC\x08\xC1\x08\xDA\x08\xF1\x08\x05\t\x13\t\"\t1\t>\tL\tg\t\x82\t\x91\t\xA3\t\xB1\t\xBD\t\xD0\t\xE2\t\xF7\t\x05\n\x14\n\"\n1\nC\nT\nd\ns\n\x84\n\x92\n\xA4\n\xB7\n\xC7\n\xD6\n\xE7\n\xF9\n\t\x0B\x1B\x0B)\x0B9\x0BH\x0BT\x0Bc\x0B~\x0B\x99\x0B\xB7\x0B\xC3\x0B\xD2\x0B\xE0\x0B\xF3\x0B\x05\x0C\x14\x0C*\x0C?\x0CQ\x0Cd\x0Cw\x0C\x8B\x0C\x9E\x0C\xB2\x0C\xC0\x0C\xCE\x0C\xDE\x0C\xF0\x0C\xFF\x0C\x13\r#\r3\rH\rY\rm\r}\r\x8A\r\x9F\r\xAF\r\xBF\r\xCF\r\xE0\r\xF2\r\x07\x0E\x1A\x0E'\x0E:\x0EI\x0EX\x0Eg\x0Ex\x0E\x86\x0E\x98\x0E\xA8\x0E\xB7\x0E\xCA\x0E\xDA\x0E\xEA\x0E\x03\x0F\x17\x0F(\x0F:\x0FK\x0F]\x0Fr\x0F\x82\x0F\x92\x0F\xA3\x0F\xB6\x0F\xBF\x0F\xCA\x0F\xD4\x0F\xDF\x0F\xE9\x0F\xF4\x0F\x01\x10\x0F\x10\x1A\x10&\x102\x10;\x10G\x10S\x10^\x10j\x10u\x10\x82\x10\x8C\x10\x9B\x10\xA9\x10\xB7\x10\xC3\x10\xCD\x10\xDA\x10\xE4\x10\xED\x10\xF7\x10\x04\x11\x12\x11\x1B\x11&\x111\x11A\x11O\x11X\x11d\x11q\x11}\x11\x8A\x11\x98\x11\xA2\x11\xB0\x11\xBC\x11\xC8\x11\xD6\x11\xE3\x11\xF0\x11\xFC\x11\x0C\x12\x1D\x12)\x124\x12>\x12H\x12T\x12a\x12l\x12w\x12\x83\x12\x94\x12\xA4\x12\xAD\x12\xB6\x12\xC5\x12\xD3\x12\xE1\x12\xEB\x12\xF8\x12\x06\x13\x12\x13\x1D\x13(\x135\x13C\x13M\x13Z\x13h\x13z\x13\x85\x13\x92\x13\x9E\x13\xA9\x13\xB6\x13\xC1\x13\xCD\x13\xD7\x13\xE1\x13\xF3\x13\x03\x14\x12\x14\x1D\x14*\x148\x14H\x14T\x14_\x14q\x14}\x14\x8C\x14\x9C\x14\xAB\x14\xBE\x14\xCD\x14\xDB\x14\xED\x14\xFD\x14\x0F\x15%\x157\x15G\x15T\x15f\x15x\x15\x8D\x15\x9F\x15\xAF\x15\xBF\x15\xCE\x15\xDE\x15\xEB\x15\xFD\x15\x10\x16#\x162\x16?\x16N\x16b\x16q\x16\x81\x16\x93\x16\xA5\x16\xB3\x16\xC7\x16\xD2\x16\xE2\x16\xED\x16\xF8\x16\x07\x17\x15\x17-\x17;\x17J\x17]\x17k\x17~\x17\x8A\x17\x9B\x17\xAD\x17\xB4\x17\xB8\x17\xBD\x17\xC1\x17\xC4\x17\xCB\x17\xD2\x17\xDB\x17\xE4\x17\xEE\x17\xF8\x17\x02\x18\x0B\x18\x14\x18\x1D\x18&\x18/\x188\x18A\x18J\x18S\x18\\\x18f\x18p\x18z\x18\x84\x18\x8E\x18\x97\x18\xA0\x18\xA9\x18\xB2\x18\xBB\x18\xC4\x18\xCD\x18\xD6\x18\xDE\x18\xEB\x18\xF2\x18\xFF\x18\n\x19\x11\x19\x19\x19)\x197\x19G\x19T\x19b\x19q\x19~\x19\x8F\x19\x9E\x19\xAE\x19\xBD\x19\xCC\x19\xDB\x19\xEC\x19\xF9\x19\t\x1A\x18\x1A'\x1A9\x1AH\x1AU\x1Ag\x1Ar\x1A~\x1A\x89\x1A\x96\x1A\xA6\x1A\xB3\x1A\xC4\x1A\xD1\x1A\xDD\x1A\xED\x1A\xF9\x1A\x06\x1B\x13\x1B!\x1B,\x1B8\x1BH\x1BU\x1B`\x1Bk\x1Bx\x1B\x89\x1B\x98\x1B\xA6\x1B\xB7\x1B\xC4\x1B\xD0\x1B\xE0\x1B\xEE\x1B\xFB\x1B\n\x1C\x1A\x1C)\x1C5\x1CC\x1CP\x1C^\x1Cn\x1C{\x1C\x88\x1C\x99\x1C\xA6\x1C\xA8\x1C\xAF\x1C\xB2\x1C\xB7\x1C\xBC\x1C\xC0\x1C\xC9\x1C\xD1\x1C\xD4\x1C\xDB\x1C\xEE\x1C\xFB\x1C\x0B\x1D\x17\x1D$\x1D4\x1D?\x1DN\x1D^\x1Dl\x1Dz\x1D~\x1D\x84\x1D\x8B\x1D\x90\x1D\x99\x1D\x9E\x1D\xAE\x1D\xBC\x1D\xCA\x1D\xCD\x1D\xD4\x1D\xDA\x1D\xDC\x1D\xE3\x1D\xEF\x1D\xFF\x1D\x13\x1E\"\x1E/\x1E=\x1EJ\x1E[\x1Ej\x1Ev\x1E\x86\x1E\x97\x1E\xA6\x1E\xB9\x1E\xC5\x1E\xD5\x1E\xE5\x1E\xF3\x1E\x05\x1F\x13\x1F$\x1F2\x1FC\x1FQ\x1F^\x1Fj\x1Fy\x1F\x87\x1F\x98\x1F\xA5\x1F\xB5\x1F\xC4\x1F\xD2\x1F\xE6\x1F\xF7\x1F\x05 \x12 . ? K W e p v ~ \x81 \x88 \x8B \x8E \x97 \x9D \xA0 \xA9 \xB2 \xBD \xC7 \xD1 \xE0 \xEA \xF3 \x04!\x0F!\x1A!$!2!:!=!A!Africa/AbidjanAfrica/AccraAfrica/Addis_AbabaAfrica/AlgiersAfrica/AsmaraAfrica/AsmeraAfrica/BamakoAfrica/BanguiAfrica/BanjulAfrica/BissauAfrica/BlantyreAfrica/BrazzavilleAfrica/BujumburaAfrica/CairoAfrica/CasablancaAfrica/CeutaAfrica/ConakryAfrica/DakarAfrica/Dar_es_SalaamAfrica/DjiboutiAfrica/DoualaAfrica/El_AaiunAfrica/FreetownAfrica/GaboroneAfrica/HarareAfrica/JohannesburgAfrica/JubaAfrica/KampalaAfrica/KhartoumAfrica/KigaliAfrica/KinshasaAfrica/LagosAfrica/LibrevilleAfrica/LomeAfrica/LuandaAfrica/LubumbashiAfrica/LusakaAfrica/MalaboAfrica/MaputoAfrica/MaseruAfrica/MbabaneAfrica/MogadishuAfrica/MonroviaAfrica/NairobiAfrica/NdjamenaAfrica/NiameyAfrica/NouakchottAfrica/OuagadougouAfrica/Porto-NovoAfrica/Sao_TomeAfrica/TimbuktuAfrica/TripoliAfrica/TunisAfrica/WindhoekAmerica/AdakAmerica/AnchorageAmerica/AnguillaAmerica/AntiguaAmerica/AraguainaAmerica/Argentina/Buenos_AiresAmerica/Argentina/CatamarcaAmerica/Argentina/ComodRivadaviaAmerica/Argentina/CordobaAmerica/Argentina/JujuyAmerica/Argentina/La_RiojaAmerica/Argentina/MendozaAmerica/Argentina/Rio_GallegosAmerica/Argentina/SaltaAmerica/Argentina/San_JuanAmerica/Argentina/San_LuisAmerica/Argentina/TucumanAmerica/Argentina/UshuaiaAmerica/ArubaAmerica/AsuncionAmerica/AtikokanAmerica/AtkaAmerica/BahiaAmerica/Bahia_BanderasAmerica/BarbadosAmerica/BelemAmerica/BelizeAmerica/Blanc-SablonAmerica/Boa_VistaAmerica/BogotaAmerica/BoiseAmerica/Buenos_AiresAmerica/Cambridge_BayAmerica/Campo_GrandeAmerica/CancunAmerica/CaracasAmerica/CatamarcaAmerica/CayenneAmerica/CaymanAmerica/ChicagoAmerica/ChihuahuaAmerica/Ciudad_JuarezAmerica/Coral_HarbourAmerica/CordobaAmerica/Costa_RicaAmerica/CrestonAmerica/CuiabaAmerica/CuracaoAmerica/DanmarkshavnAmerica/DawsonAmerica/Dawson_CreekAmerica/DenverAmerica/DetroitAmerica/DominicaAmerica/EdmontonAmerica/EirunepeAmerica/El_SalvadorAmerica/EnsenadaAmerica/Fort_NelsonAmerica/Fort_WayneAmerica/FortalezaAmerica/Glace_BayAmerica/GodthabAmerica/Goose_BayAmerica/Grand_TurkAmerica/GrenadaAmerica/GuadeloupeAmerica/GuatemalaAmerica/GuayaquilAmerica/GuyanaAmerica/HalifaxAmerica/HavanaAmerica/HermosilloAmerica/Indiana/IndianapolisAmerica/Indiana/KnoxAmerica/Indiana/MarengoAmerica/Indiana/PetersburgAmerica/Indiana/Tell_CityAmerica/Indiana/VevayAmerica/Indiana/VincennesAmerica/Indiana/WinamacAmerica/IndianapolisAmerica/InuvikAmerica/IqaluitAmerica/JamaicaAmerica/JujuyAmerica/JuneauAmerica/Kentucky/LouisvilleAmerica/Kentucky/MonticelloAmerica/Knox_INAmerica/KralendijkAmerica/La_PazAmerica/LimaAmerica/Los_AngelesAmerica/LouisvilleAmerica/Lower_PrincesAmerica/MaceioAmerica/ManaguaAmerica/ManausAmerica/MarigotAmerica/MartiniqueAmerica/MatamorosAmerica/MazatlanAmerica/MendozaAmerica/MenomineeAmerica/MeridaAmerica/MetlakatlaAmerica/Mexico_CityAmerica/MiquelonAmerica/MonctonAmerica/MonterreyAmerica/MontevideoAmerica/MontrealAmerica/MontserratAmerica/NassauAmerica/New_YorkAmerica/NipigonAmerica/NomeAmerica/NoronhaAmerica/North_Dakota/BeulahAmerica/North_Dakota/CenterAmerica/North_Dakota/New_SalemAmerica/NuukAmerica/OjinagaAmerica/PanamaAmerica/PangnirtungAmerica/ParamariboAmerica/PhoenixAmerica/Port-au-PrinceAmerica/Port_of_SpainAmerica/Porto_AcreAmerica/Porto_VelhoAmerica/Puerto_RicoAmerica/Punta_ArenasAmerica/Rainy_RiverAmerica/Rankin_InletAmerica/RecifeAmerica/ReginaAmerica/ResoluteAmerica/Rio_BrancoAmerica/RosarioAmerica/Santa_IsabelAmerica/SantaremAmerica/SantiagoAmerica/Santo_DomingoAmerica/Sao_PauloAmerica/ScoresbysundAmerica/ShiprockAmerica/SitkaAmerica/St_BarthelemyAmerica/St_JohnsAmerica/St_KittsAmerica/St_LuciaAmerica/St_ThomasAmerica/St_VincentAmerica/Swift_CurrentAmerica/TegucigalpaAmerica/ThuleAmerica/Thunder_BayAmerica/TijuanaAmerica/TorontoAmerica/TortolaAmerica/VancouverAmerica/VirginAmerica/WhitehorseAmerica/WinnipegAmerica/YakutatAmerica/YellowknifeAntarctica/CaseyAntarctica/DavisAntarctica/DumontDUrvilleAntarctica/MacquarieAntarctica/MawsonAntarctica/McMurdoAntarctica/PalmerAntarctica/RotheraAntarctica/South_PoleAntarctica/SyowaAntarctica/TrollAntarctica/VostokArctic/LongyearbyenAsia/AdenAsia/AlmatyAsia/AmmanAsia/AnadyrAsia/AqtauAsia/AqtobeAsia/AshgabatAsia/AshkhabadAsia/AtyrauAsia/BaghdadAsia/BahrainAsia/BakuAsia/BangkokAsia/BarnaulAsia/BeirutAsia/BishkekAsia/BruneiAsia/CalcuttaAsia/ChitaAsia/ChoibalsanAsia/ChongqingAsia/ChungkingAsia/ColomboAsia/DaccaAsia/DamascusAsia/DhakaAsia/DiliAsia/DubaiAsia/DushanbeAsia/FamagustaAsia/GazaAsia/HarbinAsia/HebronAsia/Ho_Chi_MinhAsia/Hong_KongAsia/HovdAsia/IrkutskAsia/IstanbulAsia/JakartaAsia/JayapuraAsia/JerusalemAsia/KabulAsia/KamchatkaAsia/KarachiAsia/KashgarAsia/KathmanduAsia/KatmanduAsia/KhandygaAsia/KolkataAsia/KrasnoyarskAsia/Kuala_LumpurAsia/KuchingAsia/KuwaitAsia/MacaoAsia/MacauAsia/MagadanAsia/MakassarAsia/ManilaAsia/MuscatAsia/NicosiaAsia/NovokuznetskAsia/NovosibirskAsia/OmskAsia/OralAsia/Phnom_PenhAsia/PontianakAsia/PyongyangAsia/QatarAsia/QostanayAsia/QyzylordaAsia/RangoonAsia/RiyadhAsia/SaigonAsia/SakhalinAsia/SamarkandAsia/SeoulAsia/ShanghaiAsia/SingaporeAsia/SrednekolymskAsia/TaipeiAsia/TashkentAsia/TbilisiAsia/TehranAsia/Tel_AvivAsia/ThimbuAsia/ThimphuAsia/TokyoAsia/TomskAsia/Ujung_PandangAsia/UlaanbaatarAsia/Ulan_BatorAsia/UrumqiAsia/Ust-NeraAsia/VientianeAsia/VladivostokAsia/YakutskAsia/YangonAsia/YekaterinburgAsia/YerevanAtlantic/AzoresAtlantic/BermudaAtlantic/CanaryAtlantic/Cape_VerdeAtlantic/FaeroeAtlantic/FaroeAtlantic/Jan_MayenAtlantic/MadeiraAtlantic/ReykjavikAtlantic/South_GeorgiaAtlantic/St_HelenaAtlantic/StanleyAustralia/ACTAustralia/AdelaideAustralia/BrisbaneAustralia/Broken_HillAustralia/CanberraAustralia/CurrieAustralia/DarwinAustralia/EuclaAustralia/HobartAustralia/LHIAustralia/LindemanAustralia/Lord_HoweAustralia/MelbourneAustralia/NorthAustralia/NSWAustralia/PerthAustralia/QueenslandAustralia/SouthAustralia/SydneyAustralia/TasmaniaAustralia/VictoriaAustralia/WestAustralia/YancowinnaBrazil/AcreBrazil/DeNoronhaBrazil/EastBrazil/WestCanada/AtlanticCanada/CentralCanada/East-SaskatchewanCanada/EasternCanada/MountainCanada/NewfoundlandCanada/PacificCanada/SaskatchewanCanada/YukonChile/ContinentalChile/EasterIslandCST6CDTCubaEgyptEireESTEST5EDTEtc/GMTEtc/GMT+0Etc/GMT+1Etc/GMT+10Etc/GMT+11Etc/GMT+12Etc/GMT+2Etc/GMT+3Etc/GMT+4Etc/GMT+5Etc/GMT+6Etc/GMT+7Etc/GMT+8Etc/GMT+9Etc/GMT-0Etc/GMT-1Etc/GMT-10Etc/GMT-11Etc/GMT-12Etc/GMT-13Etc/GMT-14Etc/GMT-2Etc/GMT-3Etc/GMT-4Etc/GMT-5Etc/GMT-6Etc/GMT-7Etc/GMT-8Etc/GMT-9Etc/GMT0Etc/GreenwichEtc/UCTEtc/UniversalEtc/UnknownEtc/UTCEtc/ZuluEurope/AmsterdamEurope/AndorraEurope/AstrakhanEurope/AthensEurope/BelfastEurope/BelgradeEurope/BerlinEurope/BratislavaEurope/BrusselsEurope/BucharestEurope/BudapestEurope/BusingenEurope/ChisinauEurope/CopenhagenEurope/DublinEurope/GibraltarEurope/GuernseyEurope/HelsinkiEurope/Isle_of_ManEurope/IstanbulEurope/JerseyEurope/KaliningradEurope/KievEurope/KirovEurope/KyivEurope/LisbonEurope/LjubljanaEurope/LondonEurope/LuxembourgEurope/MadridEurope/MaltaEurope/MariehamnEurope/MinskEurope/MonacoEurope/MoscowEurope/NicosiaEurope/OsloEurope/ParisEurope/PodgoricaEurope/PragueEurope/RigaEurope/RomeEurope/SamaraEurope/San_MarinoEurope/SarajevoEurope/SaratovEurope/SimferopolEurope/SkopjeEurope/SofiaEurope/StockholmEurope/TallinnEurope/TiraneEurope/TiraspolEurope/UlyanovskEurope/UzhgorodEurope/VaduzEurope/VaticanEurope/ViennaEurope/VilniusEurope/VolgogradEurope/WarsawEurope/ZagrebEurope/ZaporozhyeEurope/ZurichGBGB-EireGMTGMT+0GMT-0GMT0GreenwichHongkongHSTIcelandIndian/AntananarivoIndian/ChagosIndian/ChristmasIndian/CocosIndian/ComoroIndian/KerguelenIndian/MaheIndian/MaldivesIndian/MauritiusIndian/MayotteIndian/ReunionIranIsraelJamaicaJapanKwajaleinLibyaMexico/BajaNorteMexico/BajaSurMexico/GeneralMSTMST7MDTNavajoNZNZ-CHATPacific/ApiaPacific/AucklandPacific/BougainvillePacific/ChathamPacific/ChuukPacific/EasterPacific/EfatePacific/EnderburyPacific/FakaofoPacific/FijiPacific/FunafutiPacific/GalapagosPacific/GambierPacific/GuadalcanalPacific/GuamPacific/HonoluluPacific/JohnstonPacific/KantonPacific/KiritimatiPacific/KosraePacific/KwajaleinPacific/MajuroPacific/MarquesasPacific/MidwayPacific/NauruPacific/NiuePacific/NorfolkPacific/NoumeaPacific/Pago_PagoPacific/PalauPacific/PitcairnPacific/PohnpeiPacific/PonapePacific/Port_MoresbyPacific/RarotongaPacific/SaipanPacific/SamoaPacific/TahitiPacific/TarawaPacific/TongatapuPacific/TrukPacific/WakePacific/WallisPacific/YapPolandPortugalPRCPST8PDTROCROKSingaporeTurkeyUCTUniversalUS/AlaskaUS/AleutianUS/ArizonaUS/CentralUS/East-IndianaUS/EasternUS/HawaiiUS/Indiana-StarkeUS/MichiganUS/MountainUS/PacificUS/Pacific-NewUS/SamoaUTCW-SUZulu") }, unsafe { zerovec::ZeroVec::from_bytes_unchecked(b"ciabj\0\0\0ghacc\0\0\0etadd\0\0\0dzalg\0\0\0erasm\0\0\0erasm\0\0\0mlbko\0\0\0cfbgf\0\0\0gmbjl\0\0\0gwoxb\0\0\0mwblz\0\0\0cgbzv\0\0\0bibjm\0\0\0egcai\0\0\0macas\0\0\0esceu\0\0\0gncky\0\0\0sndkr\0\0\0tzdar\0\0\0djjib\0\0\0cmdla\0\0\0eheai\0\0\0slfna\0\0\0bwgbe\0\0\0zwhre\0\0\0zajnb\0\0\0ssjub\0\0\0ugkla\0\0\0sdkrt\0\0\0rwkgl\0\0\0cdfih\0\0\0nglos\0\0\0galbv\0\0\0tglfw\0\0\0aolad\0\0\0cdfbm\0\0\0zmlun\0\0\0gqssg\0\0\0mzmpm\0\0\0lsmsu\0\0\0szqmn\0\0\0somgq\0\0\0lrmlw\0\0\0kenbo\0\0\0tdndj\0\0\0nenim\0\0\0mrnkc\0\0\0bfoua\0\0\0bjptn\0\0\0sttms\0\0\0mlbko\0\0\0lytip\0\0\0tntun\0\0\0nawdh\0\0\0usadk\0\0\0usanc\0\0\0aiaxa\0\0\0aganu\0\0\0braux\0\0\0arbue\0\0\0arctc\0\0\0arctc\0\0\0arcor\0\0\0arjuj\0\0\0arirj\0\0\0armdz\0\0\0arrgl\0\0\0arsla\0\0\0aruaq\0\0\0arluq\0\0\0artuc\0\0\0arush\0\0\0awaua\0\0\0pyasu\0\0\0cayzs\0\0\0usadk\0\0\0brssa\0\0\0mxpvr\0\0\0bbbgi\0\0\0brbel\0\0\0bzbze\0\0\0caybx\0\0\0brbvb\0\0\0cobog\0\0\0usboi\0\0\0arbue\0\0\0caycb\0\0\0brcgr\0\0\0mxcun\0\0\0veccs\0\0\0arctc\0\0\0gfcay\0\0\0kygec\0\0\0uschi\0\0\0mxchi\0\0\0mxcjs\0\0\0cayzs\0\0\0arcor\0\0\0crsjo\0\0\0cacfq\0\0\0brcgb\0\0\0ancur\0\0\0gldkshvncayda\0\0\0caydq\0\0\0usden\0\0\0usdet\0\0\0dmdom\0\0\0caedm\0\0\0brern\0\0\0svsal\0\0\0mxtij\0\0\0cafne\0\0\0usind\0\0\0brfor\0\0\0caglb\0\0\0glgoh\0\0\0cagoo\0\0\0tcgdt\0\0\0gdgnd\0\0\0gpbbr\0\0\0gtgua\0\0\0ecgye\0\0\0gygeo\0\0\0cahal\0\0\0cuhav\0\0\0mxhmo\0\0\0usind\0\0\0usknx\0\0\0usaeg\0\0\0uswsq\0\0\0ustel\0\0\0usinvev\0usoea\0\0\0uswlz\0\0\0usind\0\0\0cayev\0\0\0caiql\0\0\0jmkin\0\0\0arjuj\0\0\0usjnu\0\0\0uslui\0\0\0usmoc\0\0\0usknx\0\0\0bqkra\0\0\0bolpb\0\0\0pelim\0\0\0uslax\0\0\0uslui\0\0\0sxphi\0\0\0brmcz\0\0\0nimga\0\0\0brmao\0\0\0gpmsb\0\0\0mqfdf\0\0\0mxmam\0\0\0mxmzt\0\0\0armdz\0\0\0usmnm\0\0\0mxmid\0\0\0usmtm\0\0\0mxmex\0\0\0pmmqc\0\0\0camon\0\0\0mxmty\0\0\0uymvd\0\0\0cator\0\0\0msmni\0\0\0bsnas\0\0\0usnyc\0\0\0canpg\0\0\0usome\0\0\0brfen\0\0\0usxul\0\0\0usndcnt\0usndnsl\0glgoh\0\0\0mxoji\0\0\0papty\0\0\0capnt\0\0\0srpbm\0\0\0usphx\0\0\0htpap\0\0\0ttpos\0\0\0brrbr\0\0\0brpvh\0\0\0prsju\0\0\0clpuq\0\0\0caffs\0\0\0cayek\0\0\0brrec\0\0\0careg\0\0\0careb\0\0\0brrbr\0\0\0arcor\0\0\0mxstis\0\0brstm\0\0\0clscl\0\0\0dosdq\0\0\0brsao\0\0\0globy\0\0\0usden\0\0\0ussit\0\0\0gpsbh\0\0\0casjf\0\0\0knbas\0\0\0lccas\0\0\0vistt\0\0\0vcsvd\0\0\0cayyn\0\0\0hntgu\0\0\0glthu\0\0\0cathu\0\0\0mxtij\0\0\0cator\0\0\0vgtov\0\0\0cavan\0\0\0vistt\0\0\0cayxy\0\0\0cawnp\0\0\0usyak\0\0\0cayzf\0\0\0aqcas\0\0\0aqdav\0\0\0aqddu\0\0\0aumqi\0\0\0aqmaw\0\0\0aqmcm\0\0\0aqplm\0\0\0aqrot\0\0\0nzakl\0\0\0aqsyw\0\0\0aqtrl\0\0\0aqvos\0\0\0sjlyr\0\0\0yeade\0\0\0kzala\0\0\0joamm\0\0\0rudyr\0\0\0kzaau\0\0\0kzakx\0\0\0tmasb\0\0\0tmasb\0\0\0kzguw\0\0\0iqbgw\0\0\0bhbah\0\0\0azbak\0\0\0thbkk\0\0\0rubax\0\0\0lbbey\0\0\0kgfru\0\0\0bnbwn\0\0\0inccu\0\0\0ruchita\0mncoq\0\0\0cnsha\0\0\0cnsha\0\0\0lkcmb\0\0\0bddac\0\0\0sydam\0\0\0bddac\0\0\0tldil\0\0\0aedxb\0\0\0tjdyu\0\0\0cyfmg\0\0\0gazastrpcnsha\0\0\0hebron\0\0vnsgn\0\0\0hkhkg\0\0\0mnhvd\0\0\0ruikt\0\0\0trist\0\0\0idjkt\0\0\0iddjj\0\0\0jeruslm\0afkbl\0\0\0rupkc\0\0\0pkkhi\0\0\0cnurc\0\0\0npktm\0\0\0npktm\0\0\0rukhndg\0inccu\0\0\0rukra\0\0\0mykul\0\0\0mykch\0\0\0kwkwi\0\0\0momfm\0\0\0momfm\0\0\0rugdx\0\0\0idmak\0\0\0phmnl\0\0\0ommct\0\0\0cynic\0\0\0runoz\0\0\0ruovb\0\0\0ruoms\0\0\0kzura\0\0\0khpnh\0\0\0idpnk\0\0\0kpfnj\0\0\0qadoh\0\0\0kzksn\0\0\0kzkzo\0\0\0mmrgn\0\0\0saruh\0\0\0vnsgn\0\0\0ruuus\0\0\0uzskd\0\0\0krsel\0\0\0cnsha\0\0\0sgsin\0\0\0rusred\0\0twtpe\0\0\0uztas\0\0\0getbs\0\0\0irthr\0\0\0jeruslm\0btthi\0\0\0btthi\0\0\0jptyo\0\0\0rutof\0\0\0idmak\0\0\0mnuln\0\0\0mnuln\0\0\0cnurc\0\0\0ruunera\0lavte\0\0\0ruvvo\0\0\0ruyks\0\0\0mmrgn\0\0\0ruyek\0\0\0amevn\0\0\0ptpdl\0\0\0bmbda\0\0\0eslpa\0\0\0cvrai\0\0\0fotho\0\0\0fotho\0\0\0sjlyr\0\0\0ptfnc\0\0\0isrey\0\0\0gsgrv\0\0\0shshn\0\0\0fkpsy\0\0\0ausyd\0\0\0auadl\0\0\0aubne\0\0\0aubhq\0\0\0ausyd\0\0\0aukns\0\0\0audrw\0\0\0aueuc\0\0\0auhba\0\0\0auldh\0\0\0auldc\0\0\0auldh\0\0\0aumel\0\0\0audrw\0\0\0ausyd\0\0\0auper\0\0\0aubne\0\0\0auadl\0\0\0ausyd\0\0\0auhba\0\0\0aumel\0\0\0auper\0\0\0aubhq\0\0\0brrbr\0\0\0brfen\0\0\0brsao\0\0\0brmao\0\0\0cahal\0\0\0cawnp\0\0\0careg\0\0\0cator\0\0\0caedm\0\0\0casjf\0\0\0cavan\0\0\0careg\0\0\0cayxy\0\0\0clscl\0\0\0clipc\0\0\0cst6cdt\0cuhav\0\0\0egcai\0\0\0iedub\0\0\0utcw05\0\0est5edt\0gmt\0\0\0\0\0gmt\0\0\0\0\0utcw01\0\0utcw10\0\0utcw11\0\0utcw12\0\0utcw02\0\0utcw03\0\0utcw04\0\0utcw05\0\0utcw06\0\0utcw07\0\0utcw08\0\0utcw09\0\0gmt\0\0\0\0\0utce01\0\0utce10\0\0utce11\0\0utce12\0\0utce13\0\0utce14\0\0utce02\0\0utce03\0\0utce04\0\0utce05\0\0utce06\0\0utce07\0\0utce08\0\0utce09\0\0gmt\0\0\0\0\0gmt\0\0\0\0\0utc\0\0\0\0\0utc\0\0\0\0\0unk\0\0\0\0\0utc\0\0\0\0\0utc\0\0\0\0\0nlams\0\0\0adalv\0\0\0ruasf\0\0\0grath\0\0\0gblon\0\0\0rsbeg\0\0\0deber\0\0\0skbts\0\0\0bebru\0\0\0robuh\0\0\0hubud\0\0\0debsngn\0mdkiv\0\0\0dkcph\0\0\0iedub\0\0\0gigib\0\0\0gggci\0\0\0fihel\0\0\0imdgs\0\0\0trist\0\0\0jesth\0\0\0rukgd\0\0\0uaiev\0\0\0rukvx\0\0\0uaiev\0\0\0ptlis\0\0\0silju\0\0\0gblon\0\0\0lulux\0\0\0esmad\0\0\0mtmla\0\0\0fimhq\0\0\0bymsq\0\0\0mcmon\0\0\0rumow\0\0\0cynic\0\0\0noosl\0\0\0frpar\0\0\0metgd\0\0\0czprg\0\0\0lvrix\0\0\0itrom\0\0\0rukuf\0\0\0smsai\0\0\0basjj\0\0\0rurtw\0\0\0uasip\0\0\0mkskp\0\0\0bgsof\0\0\0sesto\0\0\0eetll\0\0\0altia\0\0\0mdkiv\0\0\0ruuly\0\0\0uauzh\0\0\0livdz\0\0\0vavat\0\0\0atvie\0\0\0ltvno\0\0\0ruvog\0\0\0plwaw\0\0\0hrzag\0\0\0uaozh\0\0\0chzrh\0\0\0gblon\0\0\0gblon\0\0\0gmt\0\0\0\0\0gmt\0\0\0\0\0gmt\0\0\0\0\0gmt\0\0\0\0\0gmt\0\0\0\0\0hkhkg\0\0\0utcw10\0\0isrey\0\0\0mgtnr\0\0\0iodga\0\0\0cxxch\0\0\0cccck\0\0\0kmyva\0\0\0tfpfr\0\0\0scmaw\0\0\0mvmle\0\0\0muplu\0\0\0ytmam\0\0\0rereu\0\0\0irthr\0\0\0jeruslm\0jmkin\0\0\0jptyo\0\0\0mhkwa\0\0\0lytip\0\0\0mxtij\0\0\0mxmzt\0\0\0mxmex\0\0\0utcw07\0\0mst7mdt\0usden\0\0\0nzakl\0\0\0nzcht\0\0\0wsapw\0\0\0nzakl\0\0\0pgraw\0\0\0nzcht\0\0\0fmtkk\0\0\0clipc\0\0\0vuvli\0\0\0kipho\0\0\0tkfko\0\0\0fjsuv\0\0\0tvfun\0\0\0ecgps\0\0\0pfgmr\0\0\0sbhir\0\0\0gugum\0\0\0ushnl\0\0\0umjon\0\0\0kipho\0\0\0kicxi\0\0\0fmksa\0\0\0mhkwa\0\0\0mhmaj\0\0\0pfnhv\0\0\0ummdy\0\0\0nrinu\0\0\0nuiue\0\0\0nfnlk\0\0\0ncnou\0\0\0asppg\0\0\0pwror\0\0\0pnpcn\0\0\0fmpni\0\0\0fmpni\0\0\0pgpom\0\0\0ckrar\0\0\0mpspn\0\0\0asppg\0\0\0pfppt\0\0\0kitrw\0\0\0totbu\0\0\0fmtkk\0\0\0umawk\0\0\0wfmau\0\0\0fmtkk\0\0\0plwaw\0\0\0ptlis\0\0\0cnsha\0\0\0pst8pdt\0twtpe\0\0\0krsel\0\0\0sgsin\0\0\0trist\0\0\0utc\0\0\0\0\0utc\0\0\0\0\0usanc\0\0\0usadk\0\0\0usphx\0\0\0uschi\0\0\0usind\0\0\0usnyc\0\0\0ushnl\0\0\0usknx\0\0\0usdet\0\0\0usden\0\0\0uslax\0\0\0uslax\0\0\0asppg\0\0\0utc\0\0\0\0\0rumow\0\0\0utc\0\0\0\0\0") }) + }, + } + }; +} +#[doc(hidden)] +#[macro_export] +macro_rules! __lookup_time_zone_iana_to_bcp47_v1 { + ($ locale : expr) => {{ + static SINGLETON: ::Yokeable = singleton_time_zone_iana_to_bcp47_v1!(); + if $locale.is_empty() { + Ok(&SINGLETON) + } else { + Err(icu_provider::DataErrorKind::ExtraneousLocale) + } + }}; +} +/// Implement [`DataProvider`](icu_provider::DataProvider) on the given struct using the data +/// hardcoded in this file. This allows the struct to be used with +/// `icu`'s `_unstable` constructors. +#[doc(hidden)] +#[macro_export] +macro_rules! __impl_time_zone_iana_to_bcp47_v1 { + ($ provider : path) => { + #[clippy::msrv = "1.61"] + impl icu_provider::DataProvider for $provider { + fn load(&self, req: icu_provider::DataRequest) -> Result, icu_provider::DataError> { + match lookup_time_zone_iana_to_bcp47_v1!(req.locale) { + Ok(payload) => Ok(icu_provider::DataResponse { metadata: Default::default(), payload: Some(icu_provider::DataPayload::from_owned(icu_provider::prelude::zerofrom::ZeroFrom::zero_from(payload))) }), + Err(e) => Err(e.with_req(::KEY, req)), + } + } + } + }; +} diff --git a/provider/testdata/data/postcard/fingerprints.csv b/provider/testdata/data/postcard/fingerprints.csv index 896b278d1b5..ca86bd49da0 100644 --- a/provider/testdata/data/postcard/fingerprints.csv +++ b/provider/testdata/data/postcard/fingerprints.csv @@ -1562,6 +1562,7 @@ segmenter/line@1, und, 18811B, a5a3ac8178b6b335 segmenter/lstm/wl_auto@1, th, 72034B, c46e2e0c098c1fc1 segmenter/sentence@1, und, 14402B, 6adb54fd1dae7b09 segmenter/word@1, und, 14641B, d91c662e2d94f17f +time_zone/bcp47_to_iana@1, und, 11249B, cb1ef36ab81f994f time_zone/exemplar_cities@1, ar, 10350B, 1c554603fa64a295 time_zone/exemplar_cities@1, ar-EG, 10350B, 1c554603fa64a295 time_zone/exemplar_cities@1, bn, 15146B, fc38df62995b3e8e @@ -1638,6 +1639,7 @@ time_zone/generic_short@1, sr-Latn, 61B, da063c8d2cbb7223 time_zone/generic_short@1, th, 21B, 70edef5aa0f7a054 time_zone/generic_short@1, tr, 21B, 70edef5aa0f7a054 time_zone/generic_short@1, und, 21B, 70edef5aa0f7a054 +time_zone/iana_to_bcp47@1, und, 14475B, 55686dac5a30adc1 time_zone/metazone_period@1, und, 11270B, f204686d7a3e5ca0 time_zone/specific_long@1, ar, 11362B, a886b0294ef9f145 time_zone/specific_long@1, ar-EG, 11362B, a886b0294ef9f145 diff --git a/provider/testdata/data/testdata.postcard b/provider/testdata/data/testdata.postcard index 1fb82c32c42..7607d594a52 100644 Binary files a/provider/testdata/data/testdata.postcard and b/provider/testdata/data/testdata.postcard differ