1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
// 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 ).
// Provider structs must be stable
#![allow(clippy::exhaustive_structs, clippy::exhaustive_enums)]
//! 🚧 \[Unstable\] Data provider struct definitions for this ICU4X component.
//!
//! <div class="stab unstable">
//! 🚧 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.
//! </div>
//!
//! Read more about data providers: [`icu_provider`]
use crate::rules::runtime::ast::Rule;
use icu_provider::prelude::*;
use icu_provider::DataMarker;
#[cfg(doc)]
use crate::PluralCategory;
/// Plural rule strings conforming to UTS 35 syntax. Includes separate fields for five of the six
/// standard plural forms. If none of the rules match, the "other" category is assumed.
///
/// More information: <https://unicode.org/reports/tr35/tr35-numbers.html#Language_Plural_Rules>
///
/// <div class="stab unstable">
/// 🚧 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.
/// </div>
#[icu_provider::data_struct(
CardinalV1Marker = "plurals/cardinal@1",
OrdinalV1Marker = "plurals/ordinal@1"
)]
#[derive(Default, Clone, PartialEq, Debug)]
#[cfg_attr(
feature = "datagen",
derive(serde::Serialize, databake::Bake),
databake(path = icu_plurals::provider),
)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize))]
pub struct PluralRulesV1<'data> {
/// Rule that matches [`PluralCategory::Zero`], or `None` if not present.
#[cfg_attr(feature = "serde", serde(borrow))]
pub zero: Option<Rule<'data>>,
/// Rule that matches [`PluralCategory::One`], or `None` if not present.
#[cfg_attr(feature = "serde", serde(borrow))]
pub one: Option<Rule<'data>>,
/// Rule that matches [`PluralCategory::Two`], or `None` if not present.
#[cfg_attr(feature = "serde", serde(borrow))]
pub two: Option<Rule<'data>>,
/// Rule that matches [`PluralCategory::Few`], or `None` if not present.
#[cfg_attr(feature = "serde", serde(borrow))]
pub few: Option<Rule<'data>>,
/// Rule that matches [`PluralCategory::Many`], or `None` if not present.
#[cfg_attr(feature = "serde", serde(borrow))]
pub many: Option<Rule<'data>>,
}
pub(crate) struct ErasedPluralRulesV1Marker;
impl DataMarker for ErasedPluralRulesV1Marker {
type Yokeable = PluralRulesV1<'static>;
}