Skip to content

Commit

Permalink
NeoGetField --> GetField
Browse files Browse the repository at this point in the history
  • Loading branch information
sffc committed Oct 15, 2024
1 parent 753dd35 commit 2a3df7e
Show file tree
Hide file tree
Showing 5 changed files with 160 additions and 162 deletions.
34 changes: 17 additions & 17 deletions components/datetime/src/format/neo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use crate::helpers::size_test;
use crate::input;
use crate::input::ExtractedInput;
use crate::neo_marker::{
AllInputMarkers, DateInputMarkers, DateTimeMarkers, IsInCalendar, NeoGetField, NeoNeverMarker,
AllInputMarkers, DateInputMarkers, DateTimeMarkers, GetField, IsInCalendar, NeoNeverMarker,
NeverField, TimeMarkers, TypedDateDataMarkers, ZoneMarkers,
};
use crate::neo_pattern::{DateTimePattern, DateTimePatternBorrowed};
Expand Down Expand Up @@ -2270,12 +2270,12 @@ where
where
I: ?Sized
+ IsInCalendar<C>
+ NeoGetField<<R::D as DateInputMarkers>::YearInput>
+ NeoGetField<<R::D as DateInputMarkers>::MonthInput>
+ NeoGetField<<R::D as DateInputMarkers>::DayOfMonthInput>
+ NeoGetField<<R::D as DateInputMarkers>::DayOfWeekInput>
+ NeoGetField<<R::D as DateInputMarkers>::AnyCalendarKindInput>
+ NeoGetField<NeverField>,
+ GetField<<R::D as DateInputMarkers>::YearInput>
+ GetField<<R::D as DateInputMarkers>::MonthInput>
+ GetField<<R::D as DateInputMarkers>::DayOfMonthInput>
+ GetField<<R::D as DateInputMarkers>::DayOfWeekInput>
+ GetField<<R::D as DateInputMarkers>::AnyCalendarKindInput>
+ GetField<NeverField>,
{
FormattedDateTimePattern {
pattern: self.inner.pattern,
Expand Down Expand Up @@ -2336,11 +2336,11 @@ where
where
I: ?Sized
+ IsInCalendar<C>
+ NeoGetField<<R::T as TimeMarkers>::HourInput>
+ NeoGetField<<R::T as TimeMarkers>::MinuteInput>
+ NeoGetField<<R::T as TimeMarkers>::SecondInput>
+ NeoGetField<<R::T as TimeMarkers>::NanoSecondInput>
+ NeoGetField<NeverField>,
+ GetField<<R::T as TimeMarkers>::HourInput>
+ GetField<<R::T as TimeMarkers>::MinuteInput>
+ GetField<<R::T as TimeMarkers>::SecondInput>
+ GetField<<R::T as TimeMarkers>::NanoSecondInput>
+ GetField<NeverField>,
{
FormattedDateTimePattern {
pattern: self.inner.pattern,
Expand Down Expand Up @@ -2401,11 +2401,11 @@ where
where
I: ?Sized
+ IsInCalendar<C>
+ NeoGetField<<R::Z as ZoneMarkers>::TimeZoneOffsetInput>
+ NeoGetField<<R::Z as ZoneMarkers>::TimeZoneIdInput>
+ NeoGetField<<R::Z as ZoneMarkers>::TimeZoneMetazoneInput>
+ NeoGetField<<R::Z as ZoneMarkers>::TimeZoneVariantInput>
+ NeoGetField<NeverField>,
+ GetField<<R::Z as ZoneMarkers>::TimeZoneOffsetInput>
+ GetField<<R::Z as ZoneMarkers>::TimeZoneIdInput>
+ GetField<<R::Z as ZoneMarkers>::TimeZoneMetazoneInput>
+ GetField<<R::Z as ZoneMarkers>::TimeZoneVariantInput>
+ GetField<NeverField>,
{
FormattedDateTimePattern {
pattern: self.inner.pattern,
Expand Down
54 changes: 27 additions & 27 deletions components/datetime/src/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//! A collection of utilities for representing and working with dates as an input to
//! formatting operations.

use crate::neo_marker::{DateInputMarkers, NeoGetField, TimeMarkers, ZoneMarkers};
use crate::neo_marker::{DateInputMarkers, GetField, TimeMarkers, ZoneMarkers};
use crate::provider::time_zones::{MetazoneId, TimeZoneBcp47Id};
use icu_calendar::any_calendar::AnyCalendarKind;
use icu_timezone::{UtcOffset, ZoneVariant};
Expand Down Expand Up @@ -40,34 +40,34 @@ impl ExtractedInput {
T: TimeMarkers,
Z: ZoneMarkers,
I: ?Sized
+ NeoGetField<D::YearInput>
+ NeoGetField<D::MonthInput>
+ NeoGetField<D::DayOfMonthInput>
+ NeoGetField<D::DayOfWeekInput>
+ NeoGetField<D::AnyCalendarKindInput>
+ NeoGetField<T::HourInput>
+ NeoGetField<T::MinuteInput>
+ NeoGetField<T::SecondInput>
+ NeoGetField<T::NanoSecondInput>
+ NeoGetField<Z::TimeZoneOffsetInput>
+ NeoGetField<Z::TimeZoneIdInput>
+ NeoGetField<Z::TimeZoneMetazoneInput>
+ NeoGetField<Z::TimeZoneVariantInput>,
+ GetField<D::YearInput>
+ GetField<D::MonthInput>
+ GetField<D::DayOfMonthInput>
+ GetField<D::DayOfWeekInput>
+ GetField<D::AnyCalendarKindInput>
+ GetField<T::HourInput>
+ GetField<T::MinuteInput>
+ GetField<T::SecondInput>
+ GetField<T::NanoSecondInput>
+ GetField<Z::TimeZoneOffsetInput>
+ GetField<Z::TimeZoneIdInput>
+ GetField<Z::TimeZoneMetazoneInput>
+ GetField<Z::TimeZoneVariantInput>,
{
Self {
year: NeoGetField::<D::YearInput>::get_field(input).into(),
month: NeoGetField::<D::MonthInput>::get_field(input).into(),
day_of_month: NeoGetField::<D::DayOfMonthInput>::get_field(input).into(),
iso_weekday: NeoGetField::<D::DayOfWeekInput>::get_field(input).into(),
any_calendar_kind: NeoGetField::<D::AnyCalendarKindInput>::get_field(input).into(),
hour: NeoGetField::<T::HourInput>::get_field(input).into(),
minute: NeoGetField::<T::MinuteInput>::get_field(input).into(),
second: NeoGetField::<T::SecondInput>::get_field(input).into(),
nanosecond: NeoGetField::<T::NanoSecondInput>::get_field(input).into(),
offset: NeoGetField::<Z::TimeZoneOffsetInput>::get_field(input).into(),
time_zone_id: NeoGetField::<Z::TimeZoneIdInput>::get_field(input).into(),
metazone_id: NeoGetField::<Z::TimeZoneMetazoneInput>::get_field(input).into(),
zone_variant: NeoGetField::<Z::TimeZoneVariantInput>::get_field(input).into(),
year: GetField::<D::YearInput>::get_field(input).into(),
month: GetField::<D::MonthInput>::get_field(input).into(),
day_of_month: GetField::<D::DayOfMonthInput>::get_field(input).into(),
iso_weekday: GetField::<D::DayOfWeekInput>::get_field(input).into(),
any_calendar_kind: GetField::<D::AnyCalendarKindInput>::get_field(input).into(),
hour: GetField::<T::HourInput>::get_field(input).into(),
minute: GetField::<T::MinuteInput>::get_field(input).into(),
second: GetField::<T::SecondInput>::get_field(input).into(),
nanosecond: GetField::<T::NanoSecondInput>::get_field(input).into(),
offset: GetField::<Z::TimeZoneOffsetInput>::get_field(input).into(),
time_zone_id: GetField::<Z::TimeZoneIdInput>::get_field(input).into(),
metazone_id: GetField::<Z::TimeZoneMetazoneInput>::get_field(input).into(),
zone_variant: GetField::<Z::TimeZoneVariantInput>::get_field(input).into(),
}
}
}
62 changes: 31 additions & 31 deletions components/datetime/src/neo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ use crate::input::ExtractedInput;
use crate::neo_marker::DateInputMarkers;
use crate::neo_marker::HasConstComponents;
use crate::neo_marker::{
AllInputMarkers, CalMarkers, ConvertCalendar, DateDataMarkers, DateTimeMarkers,
IsAnyCalendarKind, IsInCalendar, IsRuntimeComponents, NeoGetField, TimeMarkers,
TypedDateDataMarkers, ZoneMarkers,
AllInputMarkers, CalMarkers, ConvertCalendar, DateDataMarkers, DateTimeMarkers, GetField,
IsAnyCalendarKind, IsInCalendar, IsRuntimeComponents, TimeMarkers, TypedDateDataMarkers,
ZoneMarkers,
};
use crate::neo_pattern::DateTimePattern;
use crate::neo_skeleton::{NeoComponents, NeoSkeletonLength};
Expand Down Expand Up @@ -119,27 +119,27 @@ impl RawNeoOptions {
pub(crate) fn from_field_set_and_locale<FSet>(field_set: &FSet, locale: &DataLocale) -> Self
where
FSet: DateTimeMarkers,
FSet: NeoGetField<FSet::LengthOption>,
FSet: NeoGetField<FSet::AlignmentOption>,
FSet: NeoGetField<FSet::YearStyleOption>,
FSet: NeoGetField<FSet::FractionalSecondDigitsOption>,
FSet: GetField<FSet::LengthOption>,
FSet: GetField<FSet::AlignmentOption>,
FSet: GetField<FSet::YearStyleOption>,
FSet: GetField<FSet::FractionalSecondDigitsOption>,
{
// TODO: Return an error if there are more options than field set
let hour_cycle = locale
.get_unicode_ext(&icu_locale_core::extensions::unicode::key!("hc"))
.as_ref()
.and_then(HourCycle::from_locale_value);
Self {
length: match NeoGetField::<FSet::LengthOption>::get_field(field_set).into() {
length: match GetField::<FSet::LengthOption>::get_field(field_set).into() {
Some(length) => length,
None => {
debug_assert!(false, "unreachable");
NeoSkeletonLength::Medium
}
},
alignment: NeoGetField::<FSet::AlignmentOption>::get_field(field_set).into(),
year_style: NeoGetField::<FSet::YearStyleOption>::get_field(field_set).into(),
fractional_second_digits: NeoGetField::<FSet::FractionalSecondDigitsOption>::get_field(
alignment: GetField::<FSet::AlignmentOption>::get_field(field_set).into(),
year_style: GetField::<FSet::YearStyleOption>::get_field(field_set).into(),
fractional_second_digits: GetField::<FSet::FractionalSecondDigitsOption>::get_field(
field_set,
)
.into(),
Expand Down Expand Up @@ -168,10 +168,10 @@ where
FSet::D: TypedDateDataMarkers<C>,
FSet::T: TimeMarkers,
FSet::Z: ZoneMarkers,
FSet: NeoGetField<FSet::LengthOption>,
FSet: NeoGetField<FSet::AlignmentOption>,
FSet: NeoGetField<FSet::YearStyleOption>,
FSet: NeoGetField<FSet::FractionalSecondDigitsOption>,
FSet: GetField<FSet::LengthOption>,
FSet: GetField<FSet::AlignmentOption>,
FSet: GetField<FSet::YearStyleOption>,
FSet: GetField<FSet::FractionalSecondDigitsOption>,
{
/// Creates a new [`TypedNeoFormatter`] from compiled data with
/// datetime components specified at build time.
Expand Down Expand Up @@ -282,10 +282,10 @@ where
FSet::D: TypedDateDataMarkers<C>,
FSet::T: TimeMarkers,
FSet::Z: ZoneMarkers,
FSet: NeoGetField<FSet::LengthOption>,
FSet: NeoGetField<FSet::AlignmentOption>,
FSet: NeoGetField<FSet::YearStyleOption>,
FSet: NeoGetField<FSet::FractionalSecondDigitsOption>,
FSet: GetField<FSet::LengthOption>,
FSet: GetField<FSet::AlignmentOption>,
FSet: GetField<FSet::YearStyleOption>,
FSet: GetField<FSet::FractionalSecondDigitsOption>,
{
/// Creates a new [`TypedNeoFormatter`] from compiled data with
/// datetime components specified at runtime.
Expand Down Expand Up @@ -596,7 +596,7 @@ where
/// )
/// .unwrap();
///
/// // the trait `NeoGetField<AnyCalendarKind>`
/// // the trait `GetField<AnyCalendarKind>`
/// // is not implemented for `icu::icu_calendar::Time`
/// formatter.format(&Time::try_new(0, 0, 0, 0).unwrap());
/// ```
Expand Down Expand Up @@ -637,10 +637,10 @@ where
FSet::D: DateDataMarkers,
FSet::T: TimeMarkers,
FSet::Z: ZoneMarkers,
FSet: NeoGetField<FSet::LengthOption>,
FSet: NeoGetField<FSet::AlignmentOption>,
FSet: NeoGetField<FSet::YearStyleOption>,
FSet: NeoGetField<FSet::FractionalSecondDigitsOption>,
FSet: GetField<FSet::LengthOption>,
FSet: GetField<FSet::AlignmentOption>,
FSet: GetField<FSet::YearStyleOption>,
FSet: GetField<FSet::FractionalSecondDigitsOption>,
{
/// Creates a new [`NeoFormatter`] from compiled data with
/// datetime components specified at build time.
Expand Down Expand Up @@ -869,10 +869,10 @@ where
FSet::D: DateDataMarkers,
FSet::T: TimeMarkers,
FSet::Z: ZoneMarkers,
FSet: NeoGetField<FSet::LengthOption>,
FSet: NeoGetField<FSet::AlignmentOption>,
FSet: NeoGetField<FSet::YearStyleOption>,
FSet: NeoGetField<FSet::FractionalSecondDigitsOption>,
FSet: GetField<FSet::LengthOption>,
FSet: GetField<FSet::AlignmentOption>,
FSet: GetField<FSet::YearStyleOption>,
FSet: GetField<FSet::FractionalSecondDigitsOption>,
{
/// Creates a new [`NeoFormatter`] from compiled data with
/// datetime components specified at runtime.
Expand Down Expand Up @@ -1338,7 +1338,7 @@ where
/// )
/// .unwrap();
///
/// // the trait `NeoGetField<AnyCalendarKind>`
/// // the trait `GetField<AnyCalendarKind>`
/// // is not implemented for `icu::icu_calendar::Time`
/// formatter.strict_format(&Time::try_new(0, 0, 0, 0).unwrap());
/// ```
Expand All @@ -1353,7 +1353,7 @@ where
return Err(crate::MismatchedCalendarError {
this_kind: self.calendar.kind(),
date_kind:
NeoGetField::<<FSet::D as DateInputMarkers>::AnyCalendarKindInput>::get_field(
GetField::<<FSet::D as DateInputMarkers>::AnyCalendarKindInput>::get_field(
datetime,
)
.into(),
Expand Down Expand Up @@ -1413,7 +1413,7 @@ where
/// )
/// .unwrap();
///
/// // the trait `NeoGetField<AnyCalendarKind>`
/// // the trait `GetField<AnyCalendarKind>`
/// // is not implemented for `icu::icu_calendar::Time`
/// formatter.convert_and_format(&Time::try_new(0, 0, 0, 0).unwrap());
/// ```
Expand Down
Loading

0 comments on commit 2a3df7e

Please sign in to comment.