Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make PluralRulesWithRanges experimental #4269

Merged
merged 1 commit into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion components/icu/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,14 @@ serde_human = [
icu_datetime_experimental = [
"icu_datetime/experimental",
]
icu_plurals_experimental = [
"icu_plurals/experimental"
]
experimental = [
"icu_compactdecimal",
"icu_datetime_experimental",
"icu_displaynames",
"icu_plurals/experimental",
"icu_plurals_experimental",
"icu_relativetime",
"icu_transliterate",
]
Expand Down
15 changes: 14 additions & 1 deletion components/plurals/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,12 @@ pub use operands::PluralOperands;
use provider::CardinalV1Marker;
use provider::ErasedPluralRulesV1Marker;
use provider::OrdinalV1Marker;
use rules::runtime::test_rule;

#[cfg(feature = "experimental")]
use provider::PluralRangesV1Marker;
#[cfg(feature = "experimental")]
use provider::UnvalidatedPluralRange;
use rules::runtime::test_rule;

#[doc(no_inline)]
pub use PluralsError as Error;
Expand Down Expand Up @@ -556,6 +559,14 @@ impl PluralRules {
/// A [`PluralRules`] that also has the ability to retrieve an appropriate [`Plural Category`] for a
/// range.
///
/// ✨ *Enabled with the `experimental` Cargo feature.*
///
/// <div class="stab unstable">
/// 🚧 This code is experimental; it may change at any time, in breaking or non-breaking ways,
/// including in SemVer minor releases. Use with caution.
/// <a href="https://github.com/unicode-org/icu4x/issues/4140">#4140</a>
/// </div>
///
/// # Examples
///
/// ```
Expand All @@ -581,12 +592,14 @@ impl PluralRules {
/// ```
///
/// [`Plural Category`]: PluralCategory
#[cfg(feature = "experimental")]
#[derive(Debug)]
pub struct PluralRulesWithRanges {
rules: PluralRules,
ranges: DataPayload<PluralRangesV1Marker>,
}

#[cfg(feature = "experimental")]
impl PluralRulesWithRanges {
icu_provider::gen_any_buffer_data_constructors!(
locale: include,
Expand Down
Loading