Skip to content

Commit

Permalink
Replace DataMarker::Yokeable by DataMarker::DataStruct (#5310)
Browse files Browse the repository at this point in the history
Fixes #4193
  • Loading branch information
robertbastian authored Jul 26, 2024
1 parent db0976d commit f78e9cc
Show file tree
Hide file tree
Showing 340 changed files with 564 additions and 562 deletions.
80 changes: 40 additions & 40 deletions components/datetime/src/calendar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,22 @@ pub trait CldrCalendar: InternalCldrCalendar {
const DEFAULT_BCP_47_IDENTIFIER: Value;

/// The data marker for loading symbols for this calendar.
type DateSymbolsV1Marker: DataMarker<Yokeable = DateSymbolsV1<'static>>;
type DateSymbolsV1Marker: DataMarker<DataStruct = DateSymbolsV1<'static>>;

/// The data marker for loading length-patterns for this calendar.
type DateLengthsV1Marker: DataMarker<Yokeable = DateLengthsV1<'static>>;
type DateLengthsV1Marker: DataMarker<DataStruct = DateLengthsV1<'static>>;

#[cfg(any(feature = "datagen", feature = "experimental"))]
/// The data marker for loading year symbols for this calendar.
type YearNamesV1Marker: DataMarker<Yokeable = YearNamesV1<'static>>;
type YearNamesV1Marker: DataMarker<DataStruct = YearNamesV1<'static>>;

#[cfg(any(feature = "datagen", feature = "experimental"))]
/// The data marker for loading month symbols for this calendar.
type MonthNamesV1Marker: DataMarker<Yokeable = MonthNamesV1<'static>>;
type MonthNamesV1Marker: DataMarker<DataStruct = MonthNamesV1<'static>>;

#[cfg(any(feature = "datagen", feature = "experimental"))]
/// The data marker for loading skeleton patterns for this calendar.
type SkeletaV1Marker: DataMarker<Yokeable = PackedSkeletonDataV1<'static>>;
type SkeletaV1Marker: DataMarker<DataStruct = PackedSkeletonDataV1<'static>>;

/// Checks if a given BCP 47 identifier is allowed to be used with this calendar
///
Expand Down Expand Up @@ -634,39 +634,39 @@ where
M: DynamicDataMarker,
{
/// The type for a [`Buddhist`] calendar
type Buddhist: DataMarker<Yokeable = M::Yokeable>;
type Buddhist: DataMarker<DataStruct = M::DataStruct>;
/// The type for a [`Chinese`] calendar
type Chinese: DataMarker<Yokeable = M::Yokeable>;
type Chinese: DataMarker<DataStruct = M::DataStruct>;
/// The type for a [`Coptic`] calendar
type Coptic: DataMarker<Yokeable = M::Yokeable>;
type Coptic: DataMarker<DataStruct = M::DataStruct>;
/// The type for a [`Dangi`] calendar
type Dangi: DataMarker<Yokeable = M::Yokeable>;
type Dangi: DataMarker<DataStruct = M::DataStruct>;
/// The type for an [`Ethiopian`] calendar, with Amete Mihret era
type Ethiopian: DataMarker<Yokeable = M::Yokeable>;
type Ethiopian: DataMarker<DataStruct = M::DataStruct>;
/// The type for an [`Ethiopian`] calendar, with Amete Alem era
type EthiopianAmeteAlem: DataMarker<Yokeable = M::Yokeable>;
type EthiopianAmeteAlem: DataMarker<DataStruct = M::DataStruct>;
/// The type for a [`Gregorian`] calendar
type Gregorian: DataMarker<Yokeable = M::Yokeable>;
type Gregorian: DataMarker<DataStruct = M::DataStruct>;
/// The type for a [`Hebrew`] calendar
type Hebrew: DataMarker<Yokeable = M::Yokeable>;
type Hebrew: DataMarker<DataStruct = M::DataStruct>;
/// The type for a [`Indian`] calendar
type Indian: DataMarker<Yokeable = M::Yokeable>;
type Indian: DataMarker<DataStruct = M::DataStruct>;
/// The type for an [`IslamicCivil`] calendar
type IslamicCivil: DataMarker<Yokeable = M::Yokeable>;
type IslamicCivil: DataMarker<DataStruct = M::DataStruct>;
/// The type for an [`IslamicObservational`] calendar
type IslamicObservational: DataMarker<Yokeable = M::Yokeable>;
type IslamicObservational: DataMarker<DataStruct = M::DataStruct>;
/// The type for an [`IslamicTabular`] calendar
type IslamicTabular: DataMarker<Yokeable = M::Yokeable>;
type IslamicTabular: DataMarker<DataStruct = M::DataStruct>;
/// The type for an [`IslamicUmmAlQura`] calendar
type IslamicUmmAlQura: DataMarker<Yokeable = M::Yokeable>;
type IslamicUmmAlQura: DataMarker<DataStruct = M::DataStruct>;
/// The type for a [`Japanese`] calendar
type Japanese: DataMarker<Yokeable = M::Yokeable>;
type Japanese: DataMarker<DataStruct = M::DataStruct>;
/// The type for a [`JapaneseExtended`] calendar
type JapaneseExtended: DataMarker<Yokeable = M::Yokeable>;
type JapaneseExtended: DataMarker<DataStruct = M::DataStruct>;
/// The type for a [`Persian`] calendar
type Persian: DataMarker<Yokeable = M::Yokeable>;
type Persian: DataMarker<DataStruct = M::DataStruct>;
/// The type for a [`Roc`] calendar
type Roc: DataMarker<Yokeable = M::Yokeable>;
type Roc: DataMarker<DataStruct = M::DataStruct>;
}

/// Implementation of [`CalMarkers`] that includes data for all calendars.
Expand All @@ -692,23 +692,23 @@ impl<M> CalMarkers<M> for NoDataCalMarkers
where
M: DynamicDataMarker,
{
type Buddhist = NeverMarker<M::Yokeable>;
type Chinese = NeverMarker<M::Yokeable>;
type Coptic = NeverMarker<M::Yokeable>;
type Dangi = NeverMarker<M::Yokeable>;
type Ethiopian = NeverMarker<M::Yokeable>;
type EthiopianAmeteAlem = NeverMarker<M::Yokeable>;
type Gregorian = NeverMarker<M::Yokeable>;
type Hebrew = NeverMarker<M::Yokeable>;
type Indian = NeverMarker<M::Yokeable>;
type IslamicCivil = NeverMarker<M::Yokeable>;
type IslamicObservational = NeverMarker<M::Yokeable>;
type IslamicTabular = NeverMarker<M::Yokeable>;
type IslamicUmmAlQura = NeverMarker<M::Yokeable>;
type Japanese = NeverMarker<M::Yokeable>;
type JapaneseExtended = NeverMarker<M::Yokeable>;
type Persian = NeverMarker<M::Yokeable>;
type Roc = NeverMarker<M::Yokeable>;
type Buddhist = NeverMarker<M::DataStruct>;
type Chinese = NeverMarker<M::DataStruct>;
type Coptic = NeverMarker<M::DataStruct>;
type Dangi = NeverMarker<M::DataStruct>;
type Ethiopian = NeverMarker<M::DataStruct>;
type EthiopianAmeteAlem = NeverMarker<M::DataStruct>;
type Gregorian = NeverMarker<M::DataStruct>;
type Hebrew = NeverMarker<M::DataStruct>;
type Indian = NeverMarker<M::DataStruct>;
type IslamicCivil = NeverMarker<M::DataStruct>;
type IslamicObservational = NeverMarker<M::DataStruct>;
type IslamicTabular = NeverMarker<M::DataStruct>;
type IslamicUmmAlQura = NeverMarker<M::DataStruct>;
type Japanese = NeverMarker<M::DataStruct>;
type JapaneseExtended = NeverMarker<M::DataStruct>;
type Persian = NeverMarker<M::DataStruct>;
type Roc = NeverMarker<M::DataStruct>;
}

#[cfg(feature = "experimental")]
Expand Down Expand Up @@ -800,7 +800,7 @@ where
JapaneseExtended => H::JapaneseExtended::INFO,
Persian => H::Persian::INFO,
Roc => H::Roc::INFO,
_ => NeverMarker::<M::Yokeable>::INFO,
_ => NeverMarker::<M::DataStruct>::INFO,
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions components/datetime/src/format/neo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ impl<M: DynamicDataMarker, Variables> DateTimeNamesData2<M, Variables> {
}

pub struct DateTimeNamesData2Borrowed<'data, M: DynamicDataMarker, Variables> {
inner: OptionalNames<Variables, &'data <M::Yokeable as Yokeable<'data>>::Output>,
inner: OptionalNames<Variables, &'data <M::DataStruct as Yokeable<'data>>::Output>,
}

impl<M: DynamicDataMarker, Variables> MaybePayload2<M, Variables>
Expand Down Expand Up @@ -251,7 +251,7 @@ where
#[inline]
pub(crate) fn as_borrowed<'a>(
&'a self,
) -> OptionalNames<Variables, &'a <M::Yokeable as Yokeable<'a>>::Output> {
) -> OptionalNames<Variables, &'a <M::DataStruct as Yokeable<'a>>::Output> {
match self {
Self::None => OptionalNames::None,
Self::SingleLength { variables, payload } => OptionalNames::SingleLength {
Expand Down
28 changes: 14 additions & 14 deletions components/datetime/src/neo_marker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -632,13 +632,13 @@ pub trait DateInputMarkers: private::Sealed {
/// (data markers only).
pub trait TypedDateDataMarkers<C>: private::Sealed {
/// Marker for loading date skeleton patterns.
type DateSkeletonPatternsV1Marker: DataMarker<Yokeable = PackedSkeletonDataV1<'static>>;
type DateSkeletonPatternsV1Marker: DataMarker<DataStruct = PackedSkeletonDataV1<'static>>;
/// Marker for loading year names.
type YearNamesV1Marker: DataMarker<Yokeable = YearNamesV1<'static>>;
type YearNamesV1Marker: DataMarker<DataStruct = YearNamesV1<'static>>;
/// Marker for loading month names.
type MonthNamesV1Marker: DataMarker<Yokeable = MonthNamesV1<'static>>;
type MonthNamesV1Marker: DataMarker<DataStruct = MonthNamesV1<'static>>;
/// Marker for loading weekday names.
type WeekdayNamesV1Marker: DataMarker<Yokeable = LinearNamesV1<'static>>;
type WeekdayNamesV1Marker: DataMarker<DataStruct = LinearNamesV1<'static>>;
}

/// A trait associating types for date formatting in any calendar
Expand All @@ -651,7 +651,7 @@ pub trait DateDataMarkers: private::Sealed {
/// Cross-calendar data markers for month names.
type Month: CalMarkers<MonthNamesV1Marker>;
/// Marker for loading weekday names.
type WeekdayNamesV1Marker: DataMarker<Yokeable = LinearNamesV1<'static>>;
type WeekdayNamesV1Marker: DataMarker<DataStruct = LinearNamesV1<'static>>;
}

/// A trait associating types for time formatting
Expand All @@ -666,9 +666,9 @@ pub trait TimeMarkers: private::Sealed {
/// Marker for resolving the any-calendar-kind input field.
type NanoSecondInput: Into<Option<NanoSecond>>;
/// Marker for loading time skeleton patterns.
type TimeSkeletonPatternsV1Marker: DataMarker<Yokeable = PackedSkeletonDataV1<'static>>;
type TimeSkeletonPatternsV1Marker: DataMarker<DataStruct = PackedSkeletonDataV1<'static>>;
/// Marker for loading day period names.
type DayPeriodNamesV1Marker: DataMarker<Yokeable = LinearNamesV1<'static>>;
type DayPeriodNamesV1Marker: DataMarker<DataStruct = LinearNamesV1<'static>>;
}

/// A trait associating types for time zone formatting
Expand All @@ -677,17 +677,17 @@ pub trait ZoneMarkers: private::Sealed {
/// Marker for resolving the time zone input field.
type TimeZoneInput: Into<Option<CustomTimeZone>>;
/// Marker for loading core time zone data.
type EssentialsV1Marker: DataMarker<Yokeable = tz::EssentialsV1<'static>>;
type EssentialsV1Marker: DataMarker<DataStruct = tz::EssentialsV1<'static>>;
/// Marker for loading exemplar city names for time zone formatting
type ExemplarCitiesV1Marker: DataMarker<Yokeable = tz::ExemplarCitiesV1<'static>>;
type ExemplarCitiesV1Marker: DataMarker<DataStruct = tz::ExemplarCitiesV1<'static>>;
/// Marker for loading generic short time zone names.
type GenericLongV1Marker: DataMarker<Yokeable = tz::MzGenericLongV1<'static>>;
type GenericLongV1Marker: DataMarker<DataStruct = tz::MzGenericLongV1<'static>>;
/// Marker for loading generic short time zone names.
type GenericShortV1Marker: DataMarker<Yokeable = tz::MzGenericShortV1<'static>>;
type GenericShortV1Marker: DataMarker<DataStruct = tz::MzGenericShortV1<'static>>;
/// Marker for loading generic short time zone names.
type SpecificLongV1Marker: DataMarker<Yokeable = tz::MzSpecificLongV1<'static>>;
type SpecificLongV1Marker: DataMarker<DataStruct = tz::MzSpecificLongV1<'static>>;
/// Marker for loading generic short time zone names.
type SpecificShortV1Marker: DataMarker<Yokeable = tz::MzSpecificShortV1<'static>>;
type SpecificShortV1Marker: DataMarker<DataStruct = tz::MzSpecificShortV1<'static>>;
}

/// A trait associating constants and types implementing various other traits
Expand All @@ -708,7 +708,7 @@ pub trait DateTimeMarkers: private::Sealed + DateTimeNamesMarker {
/// Type of the length option in the constructor.
type LengthOption: Into<Option<NeoSkeletonLength>>;
/// Marker for loading the date/time glue pattern.
type GluePatternV1Marker: DataMarker<Yokeable = GluePatternV1<'static>>;
type GluePatternV1Marker: DataMarker<DataStruct = GluePatternV1<'static>>;
}

/// Trait to consolidate input markers.
Expand Down
6 changes: 3 additions & 3 deletions components/datetime/src/provider/calendar/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ pub struct DateLengthsV1<'data> {
pub(crate) struct ErasedDateLengthsV1Marker;

impl DynamicDataMarker for ErasedDateLengthsV1Marker {
type Yokeable = DateLengthsV1<'static>;
type DataStruct = DateLengthsV1<'static>;
}

size_test!(TimeLengthsV1, time_lengths_v1_size, 264);
Expand Down Expand Up @@ -180,7 +180,7 @@ pub mod patterns {
pub(crate) struct PatternPluralsFromPatternsV1Marker;

impl DynamicDataMarker for PatternPluralsFromPatternsV1Marker {
type Yokeable = PatternPluralsV1<'static>;
type DataStruct = PatternPluralsV1<'static>;
}

/// A general purpose pattern representation. Used for date-time glue patterns.
Expand All @@ -206,7 +206,7 @@ pub mod patterns {
pub(crate) struct GenericPatternV1Marker;

impl DynamicDataMarker for GenericPatternV1Marker {
type Yokeable = GenericPatternV1<'static>;
type DataStruct = GenericPatternV1<'static>;
}

impl<'data> From<GenericPattern<'data>> for GenericPatternV1<'data> {
Expand Down
2 changes: 1 addition & 1 deletion components/datetime/src/provider/calendar/symbols.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ pub struct DateSymbolsV1<'data> {
pub(crate) struct ErasedDateSymbolsV1Marker;

impl DynamicDataMarker for ErasedDateSymbolsV1Marker {
type Yokeable = DateSymbolsV1<'static>;
type DataStruct = DateSymbolsV1<'static>;
}

size_test!(TimeSymbolsV1, time_symbols_v1_size, 768);
Expand Down
6 changes: 3 additions & 3 deletions components/datetime/src/provider/neo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -706,19 +706,19 @@ pub struct DateTimeSkeletonsV1<'data> {
#[derive(Debug)]
pub struct YearNamesV1Marker;
impl DynamicDataMarker for YearNamesV1Marker {
type Yokeable = YearNamesV1<'static>;
type DataStruct = YearNamesV1<'static>;
}

/// Calendar-agnostic month name data marker
#[derive(Debug)]
pub struct MonthNamesV1Marker;
impl DynamicDataMarker for MonthNamesV1Marker {
type Yokeable = MonthNamesV1<'static>;
type DataStruct = MonthNamesV1<'static>;
}

/// Calendar-agnostic date/time skeleta data marker
#[derive(Debug)]
pub struct SkeletaV1Marker;
impl DynamicDataMarker for SkeletaV1Marker {
type Yokeable = PackedSkeletonDataV1<'static>;
type DataStruct = PackedSkeletonDataV1<'static>;
}
16 changes: 8 additions & 8 deletions components/datetime/src/provider/neo/adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ fn month_symbols_map_project_cloned<M, P>(
req: DataRequest,
) -> Result<DataResponse<P>, DataError>
where
M: DataMarker<Yokeable = DateSymbolsV1<'static>>,
P: DataMarker<Yokeable = MonthNamesV1<'static>>,
M: DataMarker<DataStruct = DateSymbolsV1<'static>>,
P: DataMarker<DataStruct = MonthNamesV1<'static>>,
{
let new_payload = payload.try_map_project_cloned(|payload, _| {
use key_attr_consts::*;
Expand Down Expand Up @@ -73,8 +73,8 @@ fn weekday_symbols_map_project_cloned<M, P>(
req: DataRequest,
) -> Result<DataResponse<P>, DataError>
where
M: DataMarker<Yokeable = DateSymbolsV1<'static>>,
P: DataMarker<Yokeable = LinearNamesV1<'static>>,
M: DataMarker<DataStruct = DateSymbolsV1<'static>>,
P: DataMarker<DataStruct = LinearNamesV1<'static>>,
{
let new_payload = payload.try_map_project_cloned(|payload, _| {
use key_attr_consts::*;
Expand Down Expand Up @@ -120,8 +120,8 @@ fn era_symbols_map_project_cloned<M, P>(
req: DataRequest,
) -> Result<DataResponse<P>, DataError>
where
M: DataMarker<Yokeable = DateSymbolsV1<'static>>,
P: DataMarker<Yokeable = YearNamesV1<'static>>,
M: DataMarker<DataStruct = DateSymbolsV1<'static>>,
P: DataMarker<DataStruct = YearNamesV1<'static>>,
{
let new_payload = payload.try_map_project_cloned(|payload, _| {
use key_attr_consts::*;
Expand All @@ -148,8 +148,8 @@ fn dayperiod_symbols_map_project_cloned<M, P>(
req: DataRequest,
) -> Result<DataResponse<P>, DataError>
where
M: DataMarker<Yokeable = TimeSymbolsV1<'static>>,
P: DataMarker<Yokeable = LinearNamesV1<'static>>,
M: DataMarker<DataStruct = TimeSymbolsV1<'static>>,
P: DataMarker<DataStruct = LinearNamesV1<'static>>,
{
let new_payload = payload.try_map_project_cloned(|payload, _| {
use key_attr_consts::*;
Expand Down
2 changes: 1 addition & 1 deletion components/experimental/src/compactdecimal/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,5 +153,5 @@ pub struct Pattern<'data> {
pub(crate) struct ErasedCompactDecimalFormatDataV1Marker;

impl DynamicDataMarker for ErasedCompactDecimalFormatDataV1Marker {
type Yokeable = CompactDecimalPatternDataV1<'static>;
type DataStruct = CompactDecimalPatternDataV1<'static>;
}
2 changes: 1 addition & 1 deletion components/experimental/src/relativetime/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,5 +145,5 @@ impl FromStr for SingularSubPattern<'_> {
pub(crate) struct ErasedRelativeTimeFormatV1Marker;

impl DynamicDataMarker for ErasedRelativeTimeFormatV1Marker {
type Yokeable = RelativeTimePatternDataV1<'static>;
type DataStruct = RelativeTimePatternDataV1<'static>;
}

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion components/list/src/provider/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ impl<'de> serde::Deserialize<'de> for ListFormatterPatternsV2<'de> {
pub(crate) struct ErasedListV2Marker;

impl DynamicDataMarker for ErasedListV2Marker {
type Yokeable = ListFormatterPatternsV2<'static>;
type DataStruct = ListFormatterPatternsV2<'static>;
}

impl<'data> ListFormatterPatternsV2<'data> {
Expand Down
2 changes: 1 addition & 1 deletion components/plurals/src/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ pub struct PluralRulesV1<'data> {
pub(crate) struct ErasedPluralRulesV1Marker;

impl DynamicDataMarker for ErasedPluralRulesV1Marker {
type Yokeable = PluralRulesV1<'static>;
type DataStruct = PluralRulesV1<'static>;
}

#[cfg(any(feature = "datagen", feature = "experimental"))]
Expand Down
4 changes: 2 additions & 2 deletions components/properties/src/maps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub struct CodePointMapData<T: TrieValue> {
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)]
struct ErasedMaplikeMarker<T>(PhantomData<T>);
impl<T: TrieValue> DynamicDataMarker for ErasedMaplikeMarker<T> {
type Yokeable = PropertyCodePointMapV1<'static, T>;
type DataStruct = PropertyCodePointMapV1<'static, T>;
}

impl<T: TrieValue> CodePointMapData<T> {
Expand Down Expand Up @@ -88,7 +88,7 @@ impl<T: TrieValue> CodePointMapData<T> {
/// Typically it is preferable to use getters like [`load_general_category()`] instead
pub(crate) fn from_data<M>(data: DataPayload<M>) -> Self
where
M: DynamicDataMarker<Yokeable = PropertyCodePointMapV1<'static, T>>,
M: DynamicDataMarker<DataStruct = PropertyCodePointMapV1<'static, T>>,
{
Self { data: data.cast() }
}
Expand Down
Loading

0 comments on commit f78e9cc

Please sign in to comment.