Skip to content

Commit

Permalink
InSameCalendar
Browse files Browse the repository at this point in the history
  • Loading branch information
sffc committed Nov 21, 2024
1 parent 2292dbe commit 46a5131
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions components/datetime/src/neo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use crate::raw::neo::*;
use crate::scaffold::*;
use crate::scaffold::{
AllInputMarkers, ConvertCalendar, DateDataMarkers, DateInputMarkers, DateTimeMarkers, GetField,
InCalendar, InFixedCalendar, TimeMarkers, TypedDateDataMarkers, ZoneMarkers,
InFixedCalendar, InSameCalendar, TimeMarkers, TypedDateDataMarkers, ZoneMarkers,
};
use crate::size_test_macro::size_test;
use crate::DateTimeWriteError;
Expand Down Expand Up @@ -563,7 +563,7 @@ where
datetime: &I,
) -> Result<FormattedDateTime, crate::MismatchedCalendarError>
where
I: ?Sized + InCalendar + AllInputMarkers<FSet>,
I: ?Sized + InSameCalendar + AllInputMarkers<FSet>,
{
datetime.check_any_calendar_kind(self.calendar.kind())?;
let datetime =
Expand Down
14 changes: 7 additions & 7 deletions components/datetime/src/scaffold/calendar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ impl<O: TimeZoneModel> ConvertCalendar for TimeZoneInfo<O> {
}

/// An input that may be associated with a specific runtime calendar.
pub trait InCalendar {
pub trait InSameCalendar {
/// Checks whether this type is compatible with the given calendar.
///
/// Types that are agnostic to calendar systems should return `Ok(())`.
Expand All @@ -449,7 +449,7 @@ pub trait InCalendar {
) -> Result<(), MismatchedCalendarError>;
}

impl<C: Calendar, A: AsCalendar<Calendar = C>> InCalendar for Date<A> {
impl<C: Calendar, A: AsCalendar<Calendar = C>> InSameCalendar for Date<A> {
#[inline]
fn check_any_calendar_kind(
&self,
Expand All @@ -466,14 +466,14 @@ impl<C: Calendar, A: AsCalendar<Calendar = C>> InCalendar for Date<A> {
}
}

impl InCalendar for Time {
impl InSameCalendar for Time {
#[inline]
fn check_any_calendar_kind(&self, _: AnyCalendarKind) -> Result<(), MismatchedCalendarError> {
Ok(())
}
}

impl<C: Calendar, A: AsCalendar<Calendar = C>> InCalendar for DateTime<A> {
impl<C: Calendar, A: AsCalendar<Calendar = C>> InSameCalendar for DateTime<A> {
#[inline]
fn check_any_calendar_kind(
&self,
Expand All @@ -490,21 +490,21 @@ impl<C: Calendar, A: AsCalendar<Calendar = C>> InCalendar for DateTime<A> {
}
}

impl<C: Calendar, A: AsCalendar<Calendar = C>, Z> InCalendar for CustomZonedDateTime<A, Z> {
impl<C: Calendar, A: AsCalendar<Calendar = C>, Z> InSameCalendar for CustomZonedDateTime<A, Z> {
#[inline]
fn check_any_calendar_kind(&self, _: AnyCalendarKind) -> Result<(), MismatchedCalendarError> {
Ok(())
}
}

impl InCalendar for UtcOffset {
impl InSameCalendar for UtcOffset {
#[inline]
fn check_any_calendar_kind(&self, _: AnyCalendarKind) -> Result<(), MismatchedCalendarError> {
Ok(())
}
}

impl<O: TimeZoneModel> InCalendar for TimeZoneInfo<O> {
impl<O: TimeZoneModel> InSameCalendar for TimeZoneInfo<O> {
#[inline]
fn check_any_calendar_kind(&self, _: AnyCalendarKind) -> Result<(), MismatchedCalendarError> {
Ok(())
Expand Down
2 changes: 1 addition & 1 deletion components/datetime/src/scaffold/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ pub use calendar::CalMarkers;
pub use calendar::CldrCalendar;
pub use calendar::ConvertCalendar;
pub use calendar::FullDataCalMarkers;
pub use calendar::InCalendar;
pub use calendar::InFixedCalendar;
pub use calendar::InSameCalendar;
pub use calendar::NoDataCalMarkers;

pub(crate) use fieldset_traits::datetime_marker_helper;
Expand Down

0 comments on commit 46a5131

Please sign in to comment.