Skip to content

Commit

Permalink
Apply review
Browse files Browse the repository at this point in the history
  • Loading branch information
jedel1043 committed Sep 22, 2023
1 parent cbaa89e commit 3b9734c
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 23 deletions.
12 changes: 5 additions & 7 deletions components/plurals/src/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,11 @@ impl DataMarker for ErasedPluralRulesV1Marker {
#[cfg_attr(feature = "serde", derive(serde::Deserialize))]
#[yoke(prove_covariance_manually)]
pub struct PluralRangesV1<'data> {
/// Map between the categories of the endpoints of a range and its corresponding category.
/// Map between the categories of the endpoints of a range and its corresponding
/// category.
///
/// - `key0` corresponds to the start category of the range.
/// - `key1` corresponds to the end category of the range.
#[cfg_attr(feature = "serde", serde(borrow))]
pub ranges: ZeroMap2d<'data, PluralCategory, PluralCategory, PluralCategory>,
}

pub(crate) struct ErasedPluralRangesV1;

impl DataMarker for ErasedPluralRangesV1 {
type Yokeable = PluralRangesV1<'static>;
}
32 changes: 16 additions & 16 deletions provider/datagen/src/transform/cldr/cldr_serde/plural_ranges.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,6 @@ use icu_locid::LanguageIdentifier;
use serde::{de::Visitor, Deserialize};
use std::collections::HashMap;

#[derive(PartialEq, Debug, Deserialize)]
pub struct Resource {
pub supplemental: Supplemental,
}

#[derive(PartialEq, Debug, Deserialize)]
pub struct Supplemental {
pub plurals: PluralRanges,
}

#[derive(PartialEq, Debug, Deserialize)]
pub struct PluralRanges(pub HashMap<LanguageIdentifier, LocalePluralRanges>);

#[derive(PartialEq, Debug, Deserialize)]
pub struct LocalePluralRanges(pub HashMap<PluralRange, String>);

#[derive(PartialEq, PartialOrd, Ord, Eq, Hash, Debug)]
pub struct PluralRange {
pub start: String,
Expand Down Expand Up @@ -73,3 +57,19 @@ impl<'de> Deserialize<'de> for PluralRange {
deserializer.deserialize_string(PluralRangeVisitor)
}
}

#[derive(PartialEq, Debug, Deserialize)]
pub struct LocalePluralRanges(pub HashMap<PluralRange, String>);

#[derive(PartialEq, Debug, Deserialize)]
pub struct PluralRanges(pub HashMap<LanguageIdentifier, LocalePluralRanges>);

#[derive(PartialEq, Debug, Deserialize)]
pub struct Supplemental {
pub plurals: PluralRanges,
}

#[derive(PartialEq, Debug, Deserialize)]
pub struct Resource {
pub supplemental: Supplemental,
}

0 comments on commit 3b9734c

Please sign in to comment.