#![allow(clippy::exhaustive_structs, clippy::exhaustive_enums)]
use calendrical_calculations::rata_die::RataDie;
use core::ops::Deref;
use icu_provider::prelude::*;
use tinystr::TinyAsciiStr;
use zerovec::ule::{AsULE, ULE};
use zerovec::{ZeroMap2d, ZeroSlice, ZeroVec};
pub mod names;
pub mod windows;
#[cfg(feature = "compiled_data")]
#[derive(Debug)]
pub struct Baked;
#[cfg(feature = "compiled_data")]
#[allow(unused_imports)]
const _: () = {
use icu_timezone_data::*;
pub mod icu {
pub use crate as timezone;
}
make_provider!(Baked);
impl_bcp47_to_iana_map_v1_marker!(Baked);
impl_iana_to_bcp47_map_v3_marker!(Baked);
impl_windows_zones_to_bcp47_map_v1_marker!(Baked);
impl_zone_offset_period_v1_marker!(Baked);
};
#[cfg(feature = "datagen")]
pub const MARKERS: &[DataMarkerInfo] = &[
names::Bcp47ToIanaMapV1Marker::INFO,
names::IanaToBcp47MapV3Marker::INFO,
windows::WindowsZonesToBcp47MapV1Marker::INFO,
ZoneOffsetPeriodV1Marker::INFO,
];
#[repr(transparent)]
#[derive(Debug, Clone, Copy, Eq, Ord, PartialEq, PartialOrd, yoke::Yokeable, ULE, Hash)]
#[cfg_attr(feature = "datagen", derive(serde::Serialize, databake::Bake))]
#[cfg_attr(feature = "datagen", databake(path = icu_timezone::provider))]
#[cfg_attr(feature = "serde", derive(serde::Deserialize))]
pub struct TimeZoneBcp47Id(pub TinyAsciiStr<8>);
impl TimeZoneBcp47Id {
pub const fn unknown() -> Self {
Self(tinystr::tinystr!(8, "unk"))
}
}
impl Deref for TimeZoneBcp47Id {
type Target = TinyAsciiStr<8>;
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl AsULE for TimeZoneBcp47Id {
type ULE = Self;
#[inline]
fn to_unaligned(self) -> Self::ULE {
self
}
#[inline]
fn from_unaligned(unaligned: Self::ULE) -> Self {
unaligned
}
}
impl<'a> zerovec::maps::ZeroMapKV<'a> for TimeZoneBcp47Id {
type Container = ZeroVec<'a, TimeZoneBcp47Id>;
type Slice = ZeroSlice<TimeZoneBcp47Id>;
type GetType = TimeZoneBcp47Id;
type OwnedType = TimeZoneBcp47Id;
}
pub type EighthsOfHourOffset = i8;
pub type IsoMinutesSinceEpoch = i32;
pub const EPOCH: RataDie = RataDie::new(719163);
#[icu_provider::data_struct(marker(
ZoneOffsetPeriodV1Marker,
"time_zone/offset_period@1",
singleton
))]
#[derive(PartialEq, Debug, Clone, Default)]
#[cfg_attr(feature = "datagen", derive(serde::Serialize, databake::Bake))]
#[cfg_attr(feature = "datagen", databake(path = icu_timezone::provider))]
#[cfg_attr(feature = "serde", derive(serde::Deserialize))]
#[yoke(prove_covariance_manually)]
pub struct ZoneOffsetPeriodV1<'data>(
#[cfg_attr(feature = "serde", serde(borrow))]
pub ZeroMap2d<
'data,
TimeZoneBcp47Id,
IsoMinutesSinceEpoch,
(EighthsOfHourOffset, EighthsOfHourOffset),
>,
);