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

Rename marker types #4999

Merged
merged 3 commits into from
Jun 4, 2024
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
54 changes: 27 additions & 27 deletions components/datetime/src/calendar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,26 +56,26 @@ pub trait CldrCalendar: InternalCldrCalendar {
const DEFAULT_BCP_47_IDENTIFIER: Value;

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

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

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

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

#[cfg(any(feature = "datagen", feature = "experimental"))]
/// The data marker for loading a single date pattern for this calendar.
type DatePatternV1Marker: KeyedDataMarker<Yokeable = DatePatternV1<'static>>;
type DatePatternV1Marker: DataMarker<Yokeable = DatePatternV1<'static>>;

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

/// Checks if a given BCP 47 identifier is allowed to be used with this calendar
///
Expand Down Expand Up @@ -662,48 +662,48 @@ mod private {
/// A collection of marker types associated with all calendars.
///
/// This is used to group together the calendar-specific marker types that produce a common
/// [`DataMarker`]. For example, this trait can be implemented for [`YearNamesV1Marker`].
/// [`DynamicDataMarker`]. For example, this trait can be implemented for [`YearNamesV1Marker`].
///
/// This trait serves as a building block for a cross-calendar [`BoundDataProvider`].
#[cfg(any(feature = "datagen", feature = "experimental"))]
pub trait CalMarkers<M>: private::Sealed
where
M: DataMarker,
M: DynamicDataMarker,
{
/// The type for a [`Buddhist`] calendar
type Buddhist: KeyedDataMarker<Yokeable = M::Yokeable>;
type Buddhist: DataMarker<Yokeable = M::Yokeable>;
/// The type for a [`Chinese`] calendar
type Chinese: KeyedDataMarker<Yokeable = M::Yokeable>;
type Chinese: DataMarker<Yokeable = M::Yokeable>;
/// The type for a [`Coptic`] calendar
type Coptic: KeyedDataMarker<Yokeable = M::Yokeable>;
type Coptic: DataMarker<Yokeable = M::Yokeable>;
/// The type for a [`Dangi`] calendar
type Dangi: KeyedDataMarker<Yokeable = M::Yokeable>;
type Dangi: DataMarker<Yokeable = M::Yokeable>;
/// The type for an [`Ethiopian`] calendar, with Amete Mihret era
type Ethiopian: KeyedDataMarker<Yokeable = M::Yokeable>;
type Ethiopian: DataMarker<Yokeable = M::Yokeable>;
/// The type for an [`Ethiopian`] calendar, with Amete Alem era
type EthiopianAmeteAlem: KeyedDataMarker<Yokeable = M::Yokeable>;
type EthiopianAmeteAlem: DataMarker<Yokeable = M::Yokeable>;
/// The type for a [`Gregorian`] calendar
type Gregorian: KeyedDataMarker<Yokeable = M::Yokeable>;
type Gregorian: DataMarker<Yokeable = M::Yokeable>;
/// The type for a [`Hebrew`] calendar
type Hebrew: KeyedDataMarker<Yokeable = M::Yokeable>;
type Hebrew: DataMarker<Yokeable = M::Yokeable>;
/// The type for a [`Indian`] calendar
type Indian: KeyedDataMarker<Yokeable = M::Yokeable>;
type Indian: DataMarker<Yokeable = M::Yokeable>;
/// The type for an [`IslamicCivil`] calendar
type IslamicCivil: KeyedDataMarker<Yokeable = M::Yokeable>;
type IslamicCivil: DataMarker<Yokeable = M::Yokeable>;
/// The type for an [`IslamicObservational`] calendar
type IslamicObservational: KeyedDataMarker<Yokeable = M::Yokeable>;
type IslamicObservational: DataMarker<Yokeable = M::Yokeable>;
/// The type for an [`IslamicTabular`] calendar
type IslamicTabular: KeyedDataMarker<Yokeable = M::Yokeable>;
type IslamicTabular: DataMarker<Yokeable = M::Yokeable>;
/// The type for an [`IslamicUmmAlQura`] calendar
type IslamicUmmAlQura: KeyedDataMarker<Yokeable = M::Yokeable>;
type IslamicUmmAlQura: DataMarker<Yokeable = M::Yokeable>;
/// The type for a [`Japanese`] calendar
type Japanese: KeyedDataMarker<Yokeable = M::Yokeable>;
type Japanese: DataMarker<Yokeable = M::Yokeable>;
/// The type for a [`JapaneseExtended`] calendar
type JapaneseExtended: KeyedDataMarker<Yokeable = M::Yokeable>;
type JapaneseExtended: DataMarker<Yokeable = M::Yokeable>;
/// The type for a [`Persian`] calendar
type Persian: KeyedDataMarker<Yokeable = M::Yokeable>;
type Persian: DataMarker<Yokeable = M::Yokeable>;
/// The type for a [`Roc`] calendar
type Roc: KeyedDataMarker<Yokeable = M::Yokeable>;
type Roc: DataMarker<Yokeable = M::Yokeable>;
}

/// Implementation of [`CalMarkers`] that includes data for all calendars.
Expand All @@ -727,7 +727,7 @@ impl private::Sealed for NoDataCalMarkers {}
#[cfg(any(feature = "datagen", feature = "experimental"))]
impl<M> CalMarkers<M> for NoDataCalMarkers
where
M: DataMarker,
M: DynamicDataMarker,
{
type Buddhist = NeverMarker<M::Yokeable>;
type Chinese = NeverMarker<M::Yokeable>;
Expand Down Expand Up @@ -769,7 +769,7 @@ impl<H, P> AnyCalendarProvider<H, P> {
#[cfg(feature = "experimental")]
impl<M, H, P> BoundDataProvider<M> for AnyCalendarProvider<H, P>
where
M: DataMarker,
M: DynamicDataMarker,
H: CalMarkers<M>,
P: Sized
+ DataProvider<H::Buddhist>
Expand Down
18 changes: 9 additions & 9 deletions components/datetime/src/format/neo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,15 @@ where
/// Helper for type resolution with optional DataProvider arguments
pub(crate) struct PhantomProvider;

impl<M: KeyedDataMarker> DataProvider<M> for PhantomProvider {
impl<M: DataMarker> DataProvider<M> for PhantomProvider {
#[inline]
fn load(&self, req: DataRequest) -> Result<DataResponse<M>, DataError> {
debug_assert!(false);
Err(DataErrorKind::MissingDataKey.with_req(M::KEY, req))
}
}

impl<M: DataMarker> BoundDataProvider<M> for PhantomProvider {
impl<M: DynamicDataMarker> BoundDataProvider<M> for PhantomProvider {
#[inline]
fn load_bound(&self, req: DataRequest) -> Result<DataResponse<M>, DataError> {
debug_assert!(false);
Expand Down Expand Up @@ -229,11 +229,11 @@ pub trait DateTimeNamesMarker {
pub trait MaybePayload<Y: for<'a> Yokeable<'a>> {
fn maybe_from_payload<M>(payload: DataPayload<M>) -> Option<Self>
where
M: DataMarker<Yokeable = Y>,
M: DynamicDataMarker<Yokeable = Y>,
Self: Sized;
fn load_from<P, M>(provider: &P, req: DataRequest) -> Option<Result<Self, DataError>>
where
M: DataMarker<Yokeable = Y>,
M: DynamicDataMarker<Yokeable = Y>,
P: BoundDataProvider<M> + ?Sized,
Self: Sized;
#[allow(clippy::needless_lifetimes)] // Yokeable is involved
Expand All @@ -242,19 +242,19 @@ pub trait MaybePayload<Y: for<'a> Yokeable<'a>> {

impl<M0, Y: for<'a> Yokeable<'a>> MaybePayload<Y> for DataPayload<M0>
where
M0: DataMarker<Yokeable = Y>,
M0: DynamicDataMarker<Yokeable = Y>,
{
#[inline]
fn maybe_from_payload<M>(payload: DataPayload<M>) -> Option<Self>
where
M: DataMarker<Yokeable = Y>,
M: DynamicDataMarker<Yokeable = Y>,
{
Some(payload.cast())
}
#[inline]
fn load_from<P, M>(provider: &P, req: DataRequest) -> Option<Result<Self, DataError>>
where
M: DataMarker<Yokeable = Y>,
M: DynamicDataMarker<Yokeable = Y>,
P: BoundDataProvider<M> + ?Sized,
Self: Sized,
{
Expand All @@ -276,14 +276,14 @@ impl<Y: for<'a> Yokeable<'a>> MaybePayload<Y> for () {
#[inline]
fn maybe_from_payload<M>(_payload: DataPayload<M>) -> Option<Self>
where
M: DataMarker<Yokeable = Y>,
M: DynamicDataMarker<Yokeable = Y>,
{
None
}
#[inline]
fn load_from<P, M>(_provider: &P, _req: DataRequest) -> Option<Result<Self, DataError>>
where
M: DataMarker<Yokeable = Y>,
M: DynamicDataMarker<Yokeable = Y>,
P: BoundDataProvider<M> + ?Sized,
Self: Sized,
{
Expand Down
18 changes: 9 additions & 9 deletions components/datetime/src/neo_marker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ pub trait HasTimeComponents {
/// required for date formatting in a specific calendar.
pub trait TypedDateMarkers<C>: private::Sealed {
/// Marker for loading date skeleton patterns.
type DateSkeletonPatternsV1Marker: KeyedDataMarker<Yokeable = PackedSkeletonDataV1<'static>>;
type DateSkeletonPatternsV1Marker: DataMarker<Yokeable = PackedSkeletonDataV1<'static>>;
/// Marker for associating input with the specific calendar.
type TypedInputMarker: Into<Option<NeoTypedInput<C>>>;
/// Marker for resolving the year input field.
Expand All @@ -404,11 +404,11 @@ pub trait TypedDateMarkers<C>: private::Sealed {
/// Marker for resolving the any-calendar-kind input field.
type AnyCalendarKindInput: Into<Option<AnyCalendarKind>>;
/// Marker for loading year names.
type YearNamesV1Marker: KeyedDataMarker<Yokeable = YearNamesV1<'static>>;
type YearNamesV1Marker: DataMarker<Yokeable = YearNamesV1<'static>>;
/// Marker for loading month names.
type MonthNamesV1Marker: KeyedDataMarker<Yokeable = MonthNamesV1<'static>>;
type MonthNamesV1Marker: DataMarker<Yokeable = MonthNamesV1<'static>>;
/// Marker for loading weekday names.
type WeekdayNamesV1Marker: KeyedDataMarker<Yokeable = LinearNamesV1<'static>>;
type WeekdayNamesV1Marker: DataMarker<Yokeable = LinearNamesV1<'static>>;
}

/// A trait associating types implementing various other traits
Expand All @@ -433,7 +433,7 @@ pub trait DateMarkers: private::Sealed {
/// Cross-calendar data markers for month names.
type Month: CalMarkers<MonthNamesV1Marker>;
/// Marker for loading weekday names.
type WeekdayNamesV1Marker: KeyedDataMarker<Yokeable = LinearNamesV1<'static>>;
type WeekdayNamesV1Marker: DataMarker<Yokeable = LinearNamesV1<'static>>;
}

/// A trait associating types implementing various other traits
Expand All @@ -448,9 +448,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: KeyedDataMarker<Yokeable = PackedSkeletonDataV1<'static>>;
type TimeSkeletonPatternsV1Marker: DataMarker<Yokeable = PackedSkeletonDataV1<'static>>;
/// Marker for loading day period names.
type DayPeriodNamesV1Marker: KeyedDataMarker<Yokeable = LinearNamesV1<'static>>;
type DayPeriodNamesV1Marker: DataMarker<Yokeable = LinearNamesV1<'static>>;
}

/// A struct implementing traits for never loading data.
Expand Down Expand Up @@ -508,7 +508,7 @@ pub trait TypedNeoFormatterMarker<C>: private::Sealed {
/// Fields for [`TypedDateTimeNames`].
type DateTimeNamesMarker: DateTimeNamesMarker;
/// Marker for loading the date/time glue pattern.
type DateTimePatternV1Marker: KeyedDataMarker<Yokeable = DateTimePatternV1<'static>>;
type DateTimePatternV1Marker: DataMarker<Yokeable = DateTimePatternV1<'static>>;
}

/// A trait associating constants and types implementing various other traits
Expand All @@ -523,7 +523,7 @@ pub trait NeoFormatterMarker: private::Sealed {
/// Fields for [`TypedDateTimeNames`].
type DateTimeNamesMarker: DateTimeNamesMarker;
/// Marker for loading the date/time glue pattern.
type DateTimePatternV1Marker: KeyedDataMarker<Yokeable = DateTimePatternV1<'static>>;
type DateTimePatternV1Marker: DataMarker<Yokeable = DateTimePatternV1<'static>>;
}

/// A struct that supports formatting both a date and a time.
Expand Down
14 changes: 7 additions & 7 deletions components/datetime/src/neo_skeleton.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ use tinystr::TinyAsciiStr;
pub trait NeoSkeletonCommonData {
/// Marker for loading weekday names.
/// Can be [`NeverMarker`] if not needed for this skeleton.
type WeekdayNamesV1Marker: KeyedDataMarker<Yokeable = LinearNamesV1<'static>>;
type WeekdayNamesV1Marker: DataMarker<Yokeable = LinearNamesV1<'static>>;
/// Marker for loading day period names.
/// Can be [`NeverMarker`] if not needed for this skeleton.
type DayPeriodNamesV1Marker: KeyedDataMarker<Yokeable = LinearNamesV1<'static>>;
type DayPeriodNamesV1Marker: DataMarker<Yokeable = LinearNamesV1<'static>>;
/// Marker for loading time skeleton patterns.
/// Can be [`NeverMarker`] if not needed for this skeleton.
type TimeSkeletonPatternsV1Marker: KeyedDataMarker<Yokeable = PackedSkeletonDataV1<'static>>;
type TimeSkeletonPatternsV1Marker: DataMarker<Yokeable = PackedSkeletonDataV1<'static>>;
/// Marker for loading the date/time glue pattern.
/// Can be [`NeverMarker`] if not needed for this skeleton.
type DateTimePatternV1Marker: KeyedDataMarker<Yokeable = DateTimePatternV1<'static>>;
type DateTimePatternV1Marker: DataMarker<Yokeable = DateTimePatternV1<'static>>;
}

/// Sealed trait implemented by neo skeleton marker types.
Expand All @@ -41,13 +41,13 @@ where
{
/// Marker for loading year names.
/// Can be [`NeverMarker`] if not needed for this skeleton.
type YearNamesV1Marker: KeyedDataMarker<Yokeable = YearNamesV1<'static>>;
type YearNamesV1Marker: DataMarker<Yokeable = YearNamesV1<'static>>;
/// Marker for loading month names.
/// Can be [`NeverMarker`] if not needed for this skeleton.
type MonthNamesV1Marker: KeyedDataMarker<Yokeable = MonthNamesV1<'static>>;
type MonthNamesV1Marker: DataMarker<Yokeable = MonthNamesV1<'static>>;
/// Marker for loading date skeleton patterns.
/// Can be [`NeverMarker`] if not needed for this skeleton.
type DateSkeletonPatternsV1Marker: KeyedDataMarker<Yokeable = PackedSkeletonDataV1<'static>>;
type DateSkeletonPatternsV1Marker: DataMarker<Yokeable = PackedSkeletonDataV1<'static>>;
}

/// Sealed trait implemented by neo skeleton marker types.
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 @@ -58,7 +58,7 @@ pub struct DateLengthsV1<'data> {

pub(crate) struct ErasedDateLengthsV1Marker;

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

Expand Down Expand Up @@ -179,7 +179,7 @@ pub mod patterns {
/// `DataPayload<PatternPluralsV1>`.
pub(crate) struct PatternPluralsFromPatternsV1Marker;

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

Expand All @@ -205,7 +205,7 @@ pub mod patterns {
/// `DataPayload<GenericLengthPatternsV1>`.
pub(crate) struct GenericPatternV1Marker;

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

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 @@ -63,7 +63,7 @@ pub struct DateSymbolsV1<'data> {
/// For more information on date time symbols, see [`FieldSymbol`](crate::fields::FieldSymbol).
pub(crate) struct ErasedDateSymbolsV1Marker;

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

Expand Down
8 changes: 4 additions & 4 deletions components/datetime/src/provider/neo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -692,27 +692,27 @@ pub struct DateTimeSkeletonsV1<'data> {
/// Calendar-agnostic year name data marker
#[derive(Debug)]
pub struct YearNamesV1Marker;
impl DataMarker for YearNamesV1Marker {
impl DynamicDataMarker for YearNamesV1Marker {
type Yokeable = YearNamesV1<'static>;
}

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

/// Calendar-agnostic date pattern data marker
#[derive(Debug)]
pub struct DatePatternV1Marker;
impl DataMarker for DatePatternV1Marker {
impl DynamicDataMarker for DatePatternV1Marker {
type Yokeable = DatePatternV1<'static>;
}

/// Calendar-agnostic date skeleta data marker
#[derive(Debug)]
pub struct SkeletaV1Marker;
impl DataMarker for SkeletaV1Marker {
impl DynamicDataMarker for SkeletaV1Marker {
type Yokeable = PackedSkeletonDataV1<'static>;
}
Loading
Loading