use alloc::borrow::Cow;
use zerovec::ZeroMap;
use icu_provider::prelude::*;
#[cfg(feature = "compiled_data")]
pub use crate::provider::Baked;
use crate::dimension::provider::units::pattern_key::PatternKey;
icu_provider::data_marker!(
UnitsEssentialsV1,
UnitsEssentials<'static>
);
#[derive(Clone, PartialEq, Debug, yoke::Yokeable, zerofrom::ZeroFrom)]
#[cfg_attr(feature = "datagen", derive(serde::Serialize, databake::Bake))]
#[cfg_attr(feature = "datagen", databake(path = icu_experimental::dimension::provider::units::essentials))]
#[cfg_attr(feature = "serde", derive(serde::Deserialize))]
#[yoke(prove_covariance_manually)]
pub struct UnitsEssentials<'data> {
#[cfg_attr(feature = "serde", serde(borrow))]
pub prefixes: ZeroMap<'data, PatternKey, str>,
#[cfg_attr(feature = "serde", serde(borrow))]
pub per: Cow<'data, str>,
#[cfg_attr(feature = "serde", serde(borrow))]
pub times: Cow<'data, str>,
}
icu_provider::data_struct!(UnitsEssentials<'_>, #[cfg(feature = "datagen")]);
#[zerovec::make_ule(CompoundCountULE)]
#[derive(Copy, Clone, PartialOrd, Ord, PartialEq, Eq, Debug)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize))]
#[cfg_attr(feature = "datagen", derive(serde::Serialize, databake::Bake))]
#[cfg_attr(feature = "datagen", databake(path = icu_experimental::dimension::provider::units::essentials))]
#[repr(u8)]
pub enum CompoundCount {
Zero = 0,
One = 1,
Two = 2,
Few = 3,
Many = 4,
Other = 5,
}
impl From<u8> for CompoundCount {
fn from(val: u8) -> Self {
match val {
0 => CompoundCount::Zero,
1 => CompoundCount::One,
2 => CompoundCount::Two,
3 => CompoundCount::Few,
4 => CompoundCount::Many,
5 => CompoundCount::Other,
_ => unreachable!(),
}
}
}