#![allow(clippy::exhaustive_structs)]
#![allow(clippy::exhaustive_enums)]
use alloc::borrow::Cow;
use icu_provider::{yoke, zerofrom};
#[derive(Debug, PartialEq, Clone, yoke::Yokeable, zerofrom::ZeroFrom)]
#[cfg_attr(
feature = "datagen",
derive(serde::Serialize, databake::Bake),
databake(path = icu_decimal::provider),
)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize))]
pub struct AffixesV1<'data> {
#[cfg_attr(feature = "serde", serde(borrow))]
pub prefix: Cow<'data, str>,
#[cfg_attr(feature = "serde", serde(borrow))]
pub suffix: Cow<'data, str>,
}
#[derive(Debug, PartialEq, Clone, yoke::Yokeable, Copy, zerofrom::ZeroFrom)]
#[cfg_attr(
feature = "datagen",
derive(serde::Serialize, databake::Bake),
databake(path = icu_decimal::provider),
)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize))]
pub struct GroupingSizesV1 {
pub primary: u8,
pub secondary: u8,
pub min_grouping: u8,
}
#[icu_provider::data_struct(marker(
DecimalSymbolsV1Marker,
"decimal/symbols@1",
extension_key = "nu"
))]
#[derive(Debug, PartialEq, Clone)]
#[cfg_attr(
feature = "datagen",
derive(serde::Serialize, databake::Bake),
databake(path = icu_decimal::provider),
)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize))]
pub struct DecimalSymbolsV1<'data> {
#[cfg_attr(feature = "serde", serde(borrow))]
pub minus_sign_affixes: AffixesV1<'data>,
#[cfg_attr(feature = "serde", serde(borrow))]
pub plus_sign_affixes: AffixesV1<'data>,
#[cfg_attr(feature = "serde", serde(borrow))]
pub decimal_separator: Cow<'data, str>,
#[cfg_attr(feature = "serde", serde(borrow))]
pub grouping_separator: Cow<'data, str>,
pub grouping_sizes: GroupingSizesV1,
pub digits: [char; 10],
}
impl Default for DecimalSymbolsV1<'static> {
fn default() -> Self {
Self {
minus_sign_affixes: AffixesV1 {
prefix: Cow::Borrowed("-"),
suffix: Cow::Borrowed(""),
},
plus_sign_affixes: AffixesV1 {
prefix: Cow::Borrowed("+"),
suffix: Cow::Borrowed(""),
},
decimal_separator: ".".into(),
grouping_separator: ",".into(),
grouping_sizes: GroupingSizesV1 {
primary: 3,
secondary: 3,
min_grouping: 1,
},
digits: ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'],
}
}
}