|
|
@ -8,7 +8,7 @@ |
|
|
|
//! the calendar protocol), but it does aim to provide the necessary tools and API for
|
|
|
|
//! the calendar protocol), but it does aim to provide the necessary tools and API for
|
|
|
|
//! implementing one.
|
|
|
|
//! implementing one.
|
|
|
|
|
|
|
|
|
|
|
|
use std::{any::Any, str::FromStr}; |
|
|
|
use std::str::FromStr; |
|
|
|
|
|
|
|
|
|
|
|
use crate::{ |
|
|
|
use crate::{ |
|
|
|
components::{Date, DateTime, Duration, MonthDay, YearMonth}, |
|
|
|
components::{Date, DateTime, Duration, MonthDay, YearMonth}, |
|
|
@ -88,13 +88,13 @@ impl From<&[String]> for CalendarFieldsType { |
|
|
|
#[derive(Debug)] |
|
|
|
#[derive(Debug)] |
|
|
|
pub enum CalendarDateLike<C: CalendarProtocol> { |
|
|
|
pub enum CalendarDateLike<C: CalendarProtocol> { |
|
|
|
/// Represents a user-defined `Date` datelike
|
|
|
|
/// Represents a user-defined `Date` datelike
|
|
|
|
CustomDate(<<C as CalendarProtocol>::DateLikes as DateTypes<C>>::Date), |
|
|
|
CustomDate(C::Date), |
|
|
|
/// Represents a user-defined `DateTime` datelike
|
|
|
|
/// Represents a user-defined `DateTime` datelike
|
|
|
|
CustomDateTime(<<C as CalendarProtocol>::DateLikes as DateTypes<C>>::DateTime), |
|
|
|
CustomDateTime(C::DateTime), |
|
|
|
/// Represents a user-defined `YearMonth` datelike
|
|
|
|
/// Represents a user-defined `YearMonth` datelike
|
|
|
|
CustomYearMonth(<<C as CalendarProtocol>::DateLikes as DateTypes<C>>::YearMonth), |
|
|
|
CustomYearMonth(C::YearMonth), |
|
|
|
/// Represents a user-defined `MonthDay` datelike
|
|
|
|
/// Represents a user-defined `MonthDay` datelike
|
|
|
|
CustomMonthDay(<<C as CalendarProtocol>::DateLikes as DateTypes<C>>::MonthDay), |
|
|
|
CustomMonthDay(C::MonthDay), |
|
|
|
/// Represents a `DateTime<C>`.
|
|
|
|
/// Represents a `DateTime<C>`.
|
|
|
|
DateTime(DateTime<C>), |
|
|
|
DateTime(DateTime<C>), |
|
|
|
/// Represents a `Date<C>`.
|
|
|
|
/// Represents a `Date<C>`.
|
|
|
@ -117,45 +117,41 @@ impl<C: CalendarProtocol> CalendarDateLike<C> { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// TODO: DateTypes should implement a trait -> `ToTemporalDate`: `GetCalendarSlot`
|
|
|
|
// ==== CalendarProtocol trait ====
|
|
|
|
/// A trait for implementing `DateLike` types
|
|
|
|
|
|
|
|
pub trait DateTypes<C: CalendarProtocol> { |
|
|
|
/// A trait for implementing a Builtin Calendar's Calendar Protocol in Rust.
|
|
|
|
|
|
|
|
pub trait CalendarProtocol: Clone { |
|
|
|
/// A Custom `Date` Type for an associated `CalendarProtocol`. Default `Date<C>`
|
|
|
|
/// A Custom `Date` Type for an associated `CalendarProtocol`. Default `Date<C>`
|
|
|
|
type Date: IsoDateSlots + GetCalendarSlot<C> + Clone + core::fmt::Debug; |
|
|
|
type Date: IsoDateSlots + GetCalendarSlot<Self> + Clone + core::fmt::Debug; |
|
|
|
/// A Custom `DateTime` Type for an associated `CalendarProtocol`. Default `DateTime<C>`
|
|
|
|
/// A Custom `DateTime` Type for an associated `CalendarProtocol`. Default `DateTime<C>`
|
|
|
|
type DateTime: IsoDateSlots + GetCalendarSlot<C> + Clone + core::fmt::Debug; |
|
|
|
type DateTime: IsoDateSlots + GetCalendarSlot<Self> + Clone + core::fmt::Debug; |
|
|
|
/// A Custom `YearMonth` Type for an associated `CalendarProtocol`. Default `YearMonth<C>`
|
|
|
|
/// A Custom `YearMonth` Type for an associated `CalendarProtocol`. Default `YearMonth<C>`
|
|
|
|
type YearMonth: IsoDateSlots + GetCalendarSlot<C> + Clone + core::fmt::Debug; |
|
|
|
type YearMonth: IsoDateSlots + GetCalendarSlot<Self> + Clone + core::fmt::Debug; |
|
|
|
/// A Custom `MonthDay` Type for an associated `CalendarProtocol`. Default `MonthDay<C>`
|
|
|
|
/// A Custom `MonthDay` Type for an associated `CalendarProtocol`. Default `MonthDay<C>`
|
|
|
|
type MonthDay: IsoDateSlots + GetCalendarSlot<C> + Clone + core::fmt::Debug; |
|
|
|
type MonthDay: IsoDateSlots + GetCalendarSlot<Self> + Clone + core::fmt::Debug; |
|
|
|
} |
|
|
|
/// The context passed to every method of the `CalendarProtocol`.
|
|
|
|
|
|
|
|
type Context; |
|
|
|
// ==== CalendarProtocol trait ====
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// A trait for implementing a Builtin Calendar's Calendar Protocol in Rust.
|
|
|
|
|
|
|
|
pub trait CalendarProtocol: Clone { |
|
|
|
|
|
|
|
/// Registers a valid set of custom `CalendarDateLike` values.
|
|
|
|
|
|
|
|
type DateLikes: DateTypes<Self>; |
|
|
|
|
|
|
|
/// Creates a `Temporal.PlainDate` object from provided fields.
|
|
|
|
/// Creates a `Temporal.PlainDate` object from provided fields.
|
|
|
|
fn date_from_fields( |
|
|
|
fn date_from_fields( |
|
|
|
&self, |
|
|
|
&self, |
|
|
|
fields: &mut TemporalFields, |
|
|
|
fields: &mut TemporalFields, |
|
|
|
overflow: ArithmeticOverflow, |
|
|
|
overflow: ArithmeticOverflow, |
|
|
|
context: &mut dyn Any, |
|
|
|
context: &mut Self::Context, |
|
|
|
) -> TemporalResult<Date<Self>>; |
|
|
|
) -> TemporalResult<Date<Self>>; |
|
|
|
/// Creates a `Temporal.PlainYearMonth` object from the provided fields.
|
|
|
|
/// Creates a `Temporal.PlainYearMonth` object from the provided fields.
|
|
|
|
fn year_month_from_fields( |
|
|
|
fn year_month_from_fields( |
|
|
|
&self, |
|
|
|
&self, |
|
|
|
fields: &mut TemporalFields, |
|
|
|
fields: &mut TemporalFields, |
|
|
|
overflow: ArithmeticOverflow, |
|
|
|
overflow: ArithmeticOverflow, |
|
|
|
context: &mut dyn Any, |
|
|
|
context: &mut Self::Context, |
|
|
|
) -> TemporalResult<YearMonth<Self>>; |
|
|
|
) -> TemporalResult<YearMonth<Self>>; |
|
|
|
/// Creates a `Temporal.PlainMonthDay` object from the provided fields.
|
|
|
|
/// Creates a `Temporal.PlainMonthDay` object from the provided fields.
|
|
|
|
fn month_day_from_fields( |
|
|
|
fn month_day_from_fields( |
|
|
|
&self, |
|
|
|
&self, |
|
|
|
fields: &mut TemporalFields, |
|
|
|
fields: &mut TemporalFields, |
|
|
|
overflow: ArithmeticOverflow, |
|
|
|
overflow: ArithmeticOverflow, |
|
|
|
context: &mut dyn Any, |
|
|
|
context: &mut Self::Context, |
|
|
|
) -> TemporalResult<MonthDay<Self>>; |
|
|
|
) -> TemporalResult<MonthDay<Self>>; |
|
|
|
/// Returns a `Temporal.PlainDate` based off an added date.
|
|
|
|
/// Returns a `Temporal.PlainDate` based off an added date.
|
|
|
|
fn date_add( |
|
|
|
fn date_add( |
|
|
@ -163,7 +159,7 @@ pub trait CalendarProtocol: Clone { |
|
|
|
date: &Date<Self>, |
|
|
|
date: &Date<Self>, |
|
|
|
duration: &Duration, |
|
|
|
duration: &Duration, |
|
|
|
overflow: ArithmeticOverflow, |
|
|
|
overflow: ArithmeticOverflow, |
|
|
|
context: &mut dyn Any, |
|
|
|
context: &mut Self::Context, |
|
|
|
) -> TemporalResult<Date<Self>>; |
|
|
|
) -> TemporalResult<Date<Self>>; |
|
|
|
/// Returns a `Temporal.Duration` representing the duration between two dates.
|
|
|
|
/// Returns a `Temporal.Duration` representing the duration between two dates.
|
|
|
|
fn date_until( |
|
|
|
fn date_until( |
|
|
@ -171,106 +167,114 @@ pub trait CalendarProtocol: Clone { |
|
|
|
one: &Date<Self>, |
|
|
|
one: &Date<Self>, |
|
|
|
two: &Date<Self>, |
|
|
|
two: &Date<Self>, |
|
|
|
largest_unit: TemporalUnit, |
|
|
|
largest_unit: TemporalUnit, |
|
|
|
context: &mut dyn Any, |
|
|
|
context: &mut Self::Context, |
|
|
|
) -> TemporalResult<Duration>; |
|
|
|
) -> TemporalResult<Duration>; |
|
|
|
/// Returns the era for a given `temporaldatelike`.
|
|
|
|
/// Returns the era for a given `temporaldatelike`.
|
|
|
|
fn era( |
|
|
|
fn era( |
|
|
|
&self, |
|
|
|
&self, |
|
|
|
date_like: &CalendarDateLike<Self>, |
|
|
|
date_like: &CalendarDateLike<Self>, |
|
|
|
context: &mut dyn Any, |
|
|
|
context: &mut Self::Context, |
|
|
|
) -> TemporalResult<Option<TinyAsciiStr<16>>>; |
|
|
|
) -> TemporalResult<Option<TinyAsciiStr<16>>>; |
|
|
|
/// Returns the era year for a given `temporaldatelike`
|
|
|
|
/// Returns the era year for a given `temporaldatelike`
|
|
|
|
fn era_year( |
|
|
|
fn era_year( |
|
|
|
&self, |
|
|
|
&self, |
|
|
|
date_like: &CalendarDateLike<Self>, |
|
|
|
date_like: &CalendarDateLike<Self>, |
|
|
|
context: &mut dyn Any, |
|
|
|
context: &mut Self::Context, |
|
|
|
) -> TemporalResult<Option<i32>>; |
|
|
|
) -> TemporalResult<Option<i32>>; |
|
|
|
/// Returns the `year` for a given `temporaldatelike`
|
|
|
|
/// Returns the `year` for a given `temporaldatelike`
|
|
|
|
fn year( |
|
|
|
fn year( |
|
|
|
&self, |
|
|
|
&self, |
|
|
|
date_like: &CalendarDateLike<Self>, |
|
|
|
date_like: &CalendarDateLike<Self>, |
|
|
|
context: &mut dyn Any, |
|
|
|
context: &mut Self::Context, |
|
|
|
) -> TemporalResult<i32>; |
|
|
|
) -> TemporalResult<i32>; |
|
|
|
/// Returns the `month` for a given `temporaldatelike`
|
|
|
|
/// Returns the `month` for a given `temporaldatelike`
|
|
|
|
fn month( |
|
|
|
fn month( |
|
|
|
&self, |
|
|
|
&self, |
|
|
|
date_like: &CalendarDateLike<Self>, |
|
|
|
date_like: &CalendarDateLike<Self>, |
|
|
|
context: &mut dyn Any, |
|
|
|
context: &mut Self::Context, |
|
|
|
) -> TemporalResult<u8>; |
|
|
|
) -> TemporalResult<u8>; |
|
|
|
// Note: Best practice would probably be to switch to a MonthCode enum after extraction.
|
|
|
|
// Note: Best practice would probably be to switch to a MonthCode enum after extraction.
|
|
|
|
/// Returns the `monthCode` for a given `temporaldatelike`
|
|
|
|
/// Returns the `monthCode` for a given `temporaldatelike`
|
|
|
|
fn month_code( |
|
|
|
fn month_code( |
|
|
|
&self, |
|
|
|
&self, |
|
|
|
date_like: &CalendarDateLike<Self>, |
|
|
|
date_like: &CalendarDateLike<Self>, |
|
|
|
context: &mut dyn Any, |
|
|
|
context: &mut Self::Context, |
|
|
|
) -> TemporalResult<TinyAsciiStr<4>>; |
|
|
|
) -> TemporalResult<TinyAsciiStr<4>>; |
|
|
|
/// Returns the `day` for a given `temporaldatelike`
|
|
|
|
/// Returns the `day` for a given `temporaldatelike`
|
|
|
|
fn day(&self, date_like: &CalendarDateLike<Self>, context: &mut dyn Any) -> TemporalResult<u8>; |
|
|
|
fn day( |
|
|
|
|
|
|
|
&self, |
|
|
|
|
|
|
|
date_like: &CalendarDateLike<Self>, |
|
|
|
|
|
|
|
context: &mut Self::Context, |
|
|
|
|
|
|
|
) -> TemporalResult<u8>; |
|
|
|
/// Returns a value representing the day of the week for a date.
|
|
|
|
/// Returns a value representing the day of the week for a date.
|
|
|
|
fn day_of_week( |
|
|
|
fn day_of_week( |
|
|
|
&self, |
|
|
|
&self, |
|
|
|
date_like: &CalendarDateLike<Self>, |
|
|
|
date_like: &CalendarDateLike<Self>, |
|
|
|
context: &mut dyn Any, |
|
|
|
context: &mut Self::Context, |
|
|
|
) -> TemporalResult<u16>; |
|
|
|
) -> TemporalResult<u16>; |
|
|
|
/// Returns a value representing the day of the year for a given calendar.
|
|
|
|
/// Returns a value representing the day of the year for a given calendar.
|
|
|
|
fn day_of_year( |
|
|
|
fn day_of_year( |
|
|
|
&self, |
|
|
|
&self, |
|
|
|
date_like: &CalendarDateLike<Self>, |
|
|
|
date_like: &CalendarDateLike<Self>, |
|
|
|
context: &mut dyn Any, |
|
|
|
context: &mut Self::Context, |
|
|
|
) -> TemporalResult<u16>; |
|
|
|
) -> TemporalResult<u16>; |
|
|
|
/// Returns a value representing the week of the year for a given calendar.
|
|
|
|
/// Returns a value representing the week of the year for a given calendar.
|
|
|
|
fn week_of_year( |
|
|
|
fn week_of_year( |
|
|
|
&self, |
|
|
|
&self, |
|
|
|
date_like: &CalendarDateLike<Self>, |
|
|
|
date_like: &CalendarDateLike<Self>, |
|
|
|
context: &mut dyn Any, |
|
|
|
context: &mut Self::Context, |
|
|
|
) -> TemporalResult<u16>; |
|
|
|
) -> TemporalResult<u16>; |
|
|
|
/// Returns the year of a given week.
|
|
|
|
/// Returns the year of a given week.
|
|
|
|
fn year_of_week( |
|
|
|
fn year_of_week( |
|
|
|
&self, |
|
|
|
&self, |
|
|
|
date_like: &CalendarDateLike<Self>, |
|
|
|
date_like: &CalendarDateLike<Self>, |
|
|
|
context: &mut dyn Any, |
|
|
|
context: &mut Self::Context, |
|
|
|
) -> TemporalResult<i32>; |
|
|
|
) -> TemporalResult<i32>; |
|
|
|
/// Returns the days in a week for a given calendar.
|
|
|
|
/// Returns the days in a week for a given calendar.
|
|
|
|
fn days_in_week( |
|
|
|
fn days_in_week( |
|
|
|
&self, |
|
|
|
&self, |
|
|
|
date_like: &CalendarDateLike<Self>, |
|
|
|
date_like: &CalendarDateLike<Self>, |
|
|
|
context: &mut dyn Any, |
|
|
|
context: &mut Self::Context, |
|
|
|
) -> TemporalResult<u16>; |
|
|
|
) -> TemporalResult<u16>; |
|
|
|
/// Returns the days in a month for a given calendar.
|
|
|
|
/// Returns the days in a month for a given calendar.
|
|
|
|
fn days_in_month( |
|
|
|
fn days_in_month( |
|
|
|
&self, |
|
|
|
&self, |
|
|
|
date_like: &CalendarDateLike<Self>, |
|
|
|
date_like: &CalendarDateLike<Self>, |
|
|
|
context: &mut dyn Any, |
|
|
|
context: &mut Self::Context, |
|
|
|
) -> TemporalResult<u16>; |
|
|
|
) -> TemporalResult<u16>; |
|
|
|
/// Returns the days in a year for a given calendar.
|
|
|
|
/// Returns the days in a year for a given calendar.
|
|
|
|
fn days_in_year( |
|
|
|
fn days_in_year( |
|
|
|
&self, |
|
|
|
&self, |
|
|
|
date_like: &CalendarDateLike<Self>, |
|
|
|
date_like: &CalendarDateLike<Self>, |
|
|
|
context: &mut dyn Any, |
|
|
|
context: &mut Self::Context, |
|
|
|
) -> TemporalResult<u16>; |
|
|
|
) -> TemporalResult<u16>; |
|
|
|
/// Returns the months in a year for a given calendar.
|
|
|
|
/// Returns the months in a year for a given calendar.
|
|
|
|
fn months_in_year( |
|
|
|
fn months_in_year( |
|
|
|
&self, |
|
|
|
&self, |
|
|
|
date_like: &CalendarDateLike<Self>, |
|
|
|
date_like: &CalendarDateLike<Self>, |
|
|
|
context: &mut dyn Any, |
|
|
|
context: &mut Self::Context, |
|
|
|
) -> TemporalResult<u16>; |
|
|
|
) -> TemporalResult<u16>; |
|
|
|
/// Returns whether a value is within a leap year according to the designated calendar.
|
|
|
|
/// Returns whether a value is within a leap year according to the designated calendar.
|
|
|
|
fn in_leap_year( |
|
|
|
fn in_leap_year( |
|
|
|
&self, |
|
|
|
&self, |
|
|
|
date_like: &CalendarDateLike<Self>, |
|
|
|
date_like: &CalendarDateLike<Self>, |
|
|
|
context: &mut dyn Any, |
|
|
|
context: &mut Self::Context, |
|
|
|
) -> TemporalResult<bool>; |
|
|
|
) -> TemporalResult<bool>; |
|
|
|
/// Return the fields for a value.
|
|
|
|
/// Return the fields for a value.
|
|
|
|
fn fields(&self, fields: Vec<String>, context: &mut dyn Any) -> TemporalResult<Vec<String>>; |
|
|
|
fn fields( |
|
|
|
|
|
|
|
&self, |
|
|
|
|
|
|
|
fields: Vec<String>, |
|
|
|
|
|
|
|
context: &mut Self::Context, |
|
|
|
|
|
|
|
) -> TemporalResult<Vec<String>>; |
|
|
|
/// Merge fields based on the calendar and provided values.
|
|
|
|
/// Merge fields based on the calendar and provided values.
|
|
|
|
fn merge_fields( |
|
|
|
fn merge_fields( |
|
|
|
&self, |
|
|
|
&self, |
|
|
|
fields: &TemporalFields, |
|
|
|
fields: &TemporalFields, |
|
|
|
additional_fields: &TemporalFields, |
|
|
|
additional_fields: &TemporalFields, |
|
|
|
context: &mut dyn Any, |
|
|
|
context: &mut Self::Context, |
|
|
|
) -> TemporalResult<TemporalFields>; |
|
|
|
) -> TemporalResult<TemporalFields>; |
|
|
|
/// Debug name
|
|
|
|
/// Debug name
|
|
|
|
fn identifier(&self, context: &mut dyn Any) -> TemporalResult<String>; |
|
|
|
fn identifier(&self, context: &mut Self::Context) -> TemporalResult<String>; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// A trait for retrieving an internal calendar slice.
|
|
|
|
/// A trait for retrieving an internal calendar slice.
|
|
|
@ -369,7 +373,7 @@ impl<C: CalendarProtocol> CalendarSlot<C> { |
|
|
|
&self, |
|
|
|
&self, |
|
|
|
fields: &mut TemporalFields, |
|
|
|
fields: &mut TemporalFields, |
|
|
|
overflow: ArithmeticOverflow, |
|
|
|
overflow: ArithmeticOverflow, |
|
|
|
context: &mut dyn Any, |
|
|
|
context: &mut C::Context, |
|
|
|
) -> TemporalResult<Date<C>> { |
|
|
|
) -> TemporalResult<Date<C>> { |
|
|
|
match self { |
|
|
|
match self { |
|
|
|
CalendarSlot::Builtin(AnyCalendar::Iso(_)) => { |
|
|
|
CalendarSlot::Builtin(AnyCalendar::Iso(_)) => { |
|
|
@ -412,7 +416,7 @@ impl<C: CalendarProtocol> CalendarSlot<C> { |
|
|
|
&self, |
|
|
|
&self, |
|
|
|
fields: &mut TemporalFields, |
|
|
|
fields: &mut TemporalFields, |
|
|
|
overflow: ArithmeticOverflow, |
|
|
|
overflow: ArithmeticOverflow, |
|
|
|
context: &mut dyn Any, |
|
|
|
context: &mut C::Context, |
|
|
|
) -> TemporalResult<MonthDay<C>> { |
|
|
|
) -> TemporalResult<MonthDay<C>> { |
|
|
|
match self { |
|
|
|
match self { |
|
|
|
CalendarSlot::Builtin(AnyCalendar::Iso(_)) => { |
|
|
|
CalendarSlot::Builtin(AnyCalendar::Iso(_)) => { |
|
|
@ -440,7 +444,7 @@ impl<C: CalendarProtocol> CalendarSlot<C> { |
|
|
|
&self, |
|
|
|
&self, |
|
|
|
fields: &mut TemporalFields, |
|
|
|
fields: &mut TemporalFields, |
|
|
|
overflow: ArithmeticOverflow, |
|
|
|
overflow: ArithmeticOverflow, |
|
|
|
context: &mut dyn Any, |
|
|
|
context: &mut C::Context, |
|
|
|
) -> TemporalResult<YearMonth<C>> { |
|
|
|
) -> TemporalResult<YearMonth<C>> { |
|
|
|
match self { |
|
|
|
match self { |
|
|
|
CalendarSlot::Builtin(AnyCalendar::Iso(_)) => { |
|
|
|
CalendarSlot::Builtin(AnyCalendar::Iso(_)) => { |
|
|
@ -482,7 +486,7 @@ impl<C: CalendarProtocol> CalendarSlot<C> { |
|
|
|
date: &Date<C>, |
|
|
|
date: &Date<C>, |
|
|
|
duration: &Duration, |
|
|
|
duration: &Duration, |
|
|
|
overflow: ArithmeticOverflow, |
|
|
|
overflow: ArithmeticOverflow, |
|
|
|
context: &mut dyn Any, |
|
|
|
context: &mut C::Context, |
|
|
|
) -> TemporalResult<Date<C>> { |
|
|
|
) -> TemporalResult<Date<C>> { |
|
|
|
match self { |
|
|
|
match self { |
|
|
|
CalendarSlot::Builtin(_) => { |
|
|
|
CalendarSlot::Builtin(_) => { |
|
|
@ -500,7 +504,7 @@ impl<C: CalendarProtocol> CalendarSlot<C> { |
|
|
|
one: &Date<C>, |
|
|
|
one: &Date<C>, |
|
|
|
two: &Date<C>, |
|
|
|
two: &Date<C>, |
|
|
|
largest_unit: TemporalUnit, |
|
|
|
largest_unit: TemporalUnit, |
|
|
|
context: &mut dyn Any, |
|
|
|
context: &mut C::Context, |
|
|
|
) -> TemporalResult<Duration> { |
|
|
|
) -> TemporalResult<Duration> { |
|
|
|
match self { |
|
|
|
match self { |
|
|
|
CalendarSlot::Builtin(_) => { |
|
|
|
CalendarSlot::Builtin(_) => { |
|
|
@ -516,7 +520,7 @@ impl<C: CalendarProtocol> CalendarSlot<C> { |
|
|
|
pub fn era( |
|
|
|
pub fn era( |
|
|
|
&self, |
|
|
|
&self, |
|
|
|
date_like: &CalendarDateLike<C>, |
|
|
|
date_like: &CalendarDateLike<C>, |
|
|
|
context: &mut dyn Any, |
|
|
|
context: &mut C::Context, |
|
|
|
) -> TemporalResult<Option<TinyAsciiStr<16>>> { |
|
|
|
) -> TemporalResult<Option<TinyAsciiStr<16>>> { |
|
|
|
match self { |
|
|
|
match self { |
|
|
|
CalendarSlot::Builtin(AnyCalendar::Iso(_)) => Ok(None), |
|
|
|
CalendarSlot::Builtin(AnyCalendar::Iso(_)) => Ok(None), |
|
|
@ -532,7 +536,7 @@ impl<C: CalendarProtocol> CalendarSlot<C> { |
|
|
|
pub fn era_year( |
|
|
|
pub fn era_year( |
|
|
|
&self, |
|
|
|
&self, |
|
|
|
date_like: &CalendarDateLike<C>, |
|
|
|
date_like: &CalendarDateLike<C>, |
|
|
|
context: &mut dyn Any, |
|
|
|
context: &mut C::Context, |
|
|
|
) -> TemporalResult<Option<i32>> { |
|
|
|
) -> TemporalResult<Option<i32>> { |
|
|
|
match self { |
|
|
|
match self { |
|
|
|
CalendarSlot::Builtin(AnyCalendar::Iso(_)) => Ok(None), |
|
|
|
CalendarSlot::Builtin(AnyCalendar::Iso(_)) => Ok(None), |
|
|
@ -548,7 +552,7 @@ impl<C: CalendarProtocol> CalendarSlot<C> { |
|
|
|
pub fn year( |
|
|
|
pub fn year( |
|
|
|
&self, |
|
|
|
&self, |
|
|
|
date_like: &CalendarDateLike<C>, |
|
|
|
date_like: &CalendarDateLike<C>, |
|
|
|
context: &mut dyn Any, |
|
|
|
context: &mut C::Context, |
|
|
|
) -> TemporalResult<i32> { |
|
|
|
) -> TemporalResult<i32> { |
|
|
|
match self { |
|
|
|
match self { |
|
|
|
CalendarSlot::Builtin(AnyCalendar::Iso(_)) => Ok(date_like.as_iso_date().year), |
|
|
|
CalendarSlot::Builtin(AnyCalendar::Iso(_)) => Ok(date_like.as_iso_date().year), |
|
|
@ -564,7 +568,7 @@ impl<C: CalendarProtocol> CalendarSlot<C> { |
|
|
|
pub fn month( |
|
|
|
pub fn month( |
|
|
|
&self, |
|
|
|
&self, |
|
|
|
date_like: &CalendarDateLike<C>, |
|
|
|
date_like: &CalendarDateLike<C>, |
|
|
|
context: &mut dyn Any, |
|
|
|
context: &mut C::Context, |
|
|
|
) -> TemporalResult<u8> { |
|
|
|
) -> TemporalResult<u8> { |
|
|
|
match self { |
|
|
|
match self { |
|
|
|
CalendarSlot::Builtin(AnyCalendar::Iso(_)) => Ok(date_like.as_iso_date().month), |
|
|
|
CalendarSlot::Builtin(AnyCalendar::Iso(_)) => Ok(date_like.as_iso_date().month), |
|
|
@ -579,7 +583,7 @@ impl<C: CalendarProtocol> CalendarSlot<C> { |
|
|
|
pub fn month_code( |
|
|
|
pub fn month_code( |
|
|
|
&self, |
|
|
|
&self, |
|
|
|
date_like: &CalendarDateLike<C>, |
|
|
|
date_like: &CalendarDateLike<C>, |
|
|
|
context: &mut dyn Any, |
|
|
|
context: &mut C::Context, |
|
|
|
) -> TemporalResult<TinyAsciiStr<4>> { |
|
|
|
) -> TemporalResult<TinyAsciiStr<4>> { |
|
|
|
match self { |
|
|
|
match self { |
|
|
|
CalendarSlot::Builtin(AnyCalendar::Iso(_)) => { |
|
|
|
CalendarSlot::Builtin(AnyCalendar::Iso(_)) => { |
|
|
@ -596,7 +600,7 @@ impl<C: CalendarProtocol> CalendarSlot<C> { |
|
|
|
pub fn day( |
|
|
|
pub fn day( |
|
|
|
&self, |
|
|
|
&self, |
|
|
|
date_like: &CalendarDateLike<C>, |
|
|
|
date_like: &CalendarDateLike<C>, |
|
|
|
context: &mut dyn Any, |
|
|
|
context: &mut C::Context, |
|
|
|
) -> TemporalResult<u8> { |
|
|
|
) -> TemporalResult<u8> { |
|
|
|
match self { |
|
|
|
match self { |
|
|
|
CalendarSlot::Builtin(AnyCalendar::Iso(_)) => Ok(date_like.as_iso_date().day), |
|
|
|
CalendarSlot::Builtin(AnyCalendar::Iso(_)) => Ok(date_like.as_iso_date().day), |
|
|
@ -611,7 +615,7 @@ impl<C: CalendarProtocol> CalendarSlot<C> { |
|
|
|
pub fn day_of_week( |
|
|
|
pub fn day_of_week( |
|
|
|
&self, |
|
|
|
&self, |
|
|
|
date_like: &CalendarDateLike<C>, |
|
|
|
date_like: &CalendarDateLike<C>, |
|
|
|
context: &mut dyn Any, |
|
|
|
context: &mut C::Context, |
|
|
|
) -> TemporalResult<u16> { |
|
|
|
) -> TemporalResult<u16> { |
|
|
|
match self { |
|
|
|
match self { |
|
|
|
CalendarSlot::Builtin(AnyCalendar::Iso(_)) => { |
|
|
|
CalendarSlot::Builtin(AnyCalendar::Iso(_)) => { |
|
|
@ -628,7 +632,7 @@ impl<C: CalendarProtocol> CalendarSlot<C> { |
|
|
|
pub fn day_of_year( |
|
|
|
pub fn day_of_year( |
|
|
|
&self, |
|
|
|
&self, |
|
|
|
date_like: &CalendarDateLike<C>, |
|
|
|
date_like: &CalendarDateLike<C>, |
|
|
|
context: &mut dyn Any, |
|
|
|
context: &mut C::Context, |
|
|
|
) -> TemporalResult<u16> { |
|
|
|
) -> TemporalResult<u16> { |
|
|
|
match self { |
|
|
|
match self { |
|
|
|
CalendarSlot::Builtin(AnyCalendar::Iso(_)) => Ok(date_like |
|
|
|
CalendarSlot::Builtin(AnyCalendar::Iso(_)) => Ok(date_like |
|
|
@ -647,7 +651,7 @@ impl<C: CalendarProtocol> CalendarSlot<C> { |
|
|
|
pub fn week_of_year( |
|
|
|
pub fn week_of_year( |
|
|
|
&self, |
|
|
|
&self, |
|
|
|
date_like: &CalendarDateLike<C>, |
|
|
|
date_like: &CalendarDateLike<C>, |
|
|
|
context: &mut dyn Any, |
|
|
|
context: &mut C::Context, |
|
|
|
) -> TemporalResult<u16> { |
|
|
|
) -> TemporalResult<u16> { |
|
|
|
match self { |
|
|
|
match self { |
|
|
|
CalendarSlot::Builtin(AnyCalendar::Iso(_)) => { |
|
|
|
CalendarSlot::Builtin(AnyCalendar::Iso(_)) => { |
|
|
@ -672,7 +676,7 @@ impl<C: CalendarProtocol> CalendarSlot<C> { |
|
|
|
pub fn year_of_week( |
|
|
|
pub fn year_of_week( |
|
|
|
&self, |
|
|
|
&self, |
|
|
|
date_like: &CalendarDateLike<C>, |
|
|
|
date_like: &CalendarDateLike<C>, |
|
|
|
context: &mut dyn Any, |
|
|
|
context: &mut C::Context, |
|
|
|
) -> TemporalResult<i32> { |
|
|
|
) -> TemporalResult<i32> { |
|
|
|
match self { |
|
|
|
match self { |
|
|
|
CalendarSlot::Builtin(AnyCalendar::Iso(_)) => { |
|
|
|
CalendarSlot::Builtin(AnyCalendar::Iso(_)) => { |
|
|
@ -701,7 +705,7 @@ impl<C: CalendarProtocol> CalendarSlot<C> { |
|
|
|
pub fn days_in_week( |
|
|
|
pub fn days_in_week( |
|
|
|
&self, |
|
|
|
&self, |
|
|
|
date_like: &CalendarDateLike<C>, |
|
|
|
date_like: &CalendarDateLike<C>, |
|
|
|
context: &mut dyn Any, |
|
|
|
context: &mut C::Context, |
|
|
|
) -> TemporalResult<u16> { |
|
|
|
) -> TemporalResult<u16> { |
|
|
|
match self { |
|
|
|
match self { |
|
|
|
CalendarSlot::Builtin(AnyCalendar::Iso(_)) => Ok(7), |
|
|
|
CalendarSlot::Builtin(AnyCalendar::Iso(_)) => Ok(7), |
|
|
@ -716,7 +720,7 @@ impl<C: CalendarProtocol> CalendarSlot<C> { |
|
|
|
pub fn days_in_month( |
|
|
|
pub fn days_in_month( |
|
|
|
&self, |
|
|
|
&self, |
|
|
|
date_like: &CalendarDateLike<C>, |
|
|
|
date_like: &CalendarDateLike<C>, |
|
|
|
context: &mut dyn Any, |
|
|
|
context: &mut C::Context, |
|
|
|
) -> TemporalResult<u16> { |
|
|
|
) -> TemporalResult<u16> { |
|
|
|
match self { |
|
|
|
match self { |
|
|
|
CalendarSlot::Builtin(AnyCalendar::Iso(_)) => { |
|
|
|
CalendarSlot::Builtin(AnyCalendar::Iso(_)) => { |
|
|
@ -734,7 +738,7 @@ impl<C: CalendarProtocol> CalendarSlot<C> { |
|
|
|
pub fn days_in_year( |
|
|
|
pub fn days_in_year( |
|
|
|
&self, |
|
|
|
&self, |
|
|
|
date_like: &CalendarDateLike<C>, |
|
|
|
date_like: &CalendarDateLike<C>, |
|
|
|
context: &mut dyn Any, |
|
|
|
context: &mut C::Context, |
|
|
|
) -> TemporalResult<u16> { |
|
|
|
) -> TemporalResult<u16> { |
|
|
|
match self { |
|
|
|
match self { |
|
|
|
CalendarSlot::Builtin(AnyCalendar::Iso(_)) => { |
|
|
|
CalendarSlot::Builtin(AnyCalendar::Iso(_)) => { |
|
|
@ -751,7 +755,7 @@ impl<C: CalendarProtocol> CalendarSlot<C> { |
|
|
|
pub fn months_in_year( |
|
|
|
pub fn months_in_year( |
|
|
|
&self, |
|
|
|
&self, |
|
|
|
date_like: &CalendarDateLike<C>, |
|
|
|
date_like: &CalendarDateLike<C>, |
|
|
|
context: &mut dyn Any, |
|
|
|
context: &mut C::Context, |
|
|
|
) -> TemporalResult<u16> { |
|
|
|
) -> TemporalResult<u16> { |
|
|
|
match self { |
|
|
|
match self { |
|
|
|
CalendarSlot::Builtin(AnyCalendar::Iso(_)) => Ok(12), |
|
|
|
CalendarSlot::Builtin(AnyCalendar::Iso(_)) => Ok(12), |
|
|
@ -766,7 +770,7 @@ impl<C: CalendarProtocol> CalendarSlot<C> { |
|
|
|
pub fn in_leap_year( |
|
|
|
pub fn in_leap_year( |
|
|
|
&self, |
|
|
|
&self, |
|
|
|
date_like: &CalendarDateLike<C>, |
|
|
|
date_like: &CalendarDateLike<C>, |
|
|
|
context: &mut dyn Any, |
|
|
|
context: &mut C::Context, |
|
|
|
) -> TemporalResult<bool> { |
|
|
|
) -> TemporalResult<bool> { |
|
|
|
match self { |
|
|
|
match self { |
|
|
|
CalendarSlot::Builtin(AnyCalendar::Iso(_)) => { |
|
|
|
CalendarSlot::Builtin(AnyCalendar::Iso(_)) => { |
|
|
@ -783,7 +787,7 @@ impl<C: CalendarProtocol> CalendarSlot<C> { |
|
|
|
pub fn fields( |
|
|
|
pub fn fields( |
|
|
|
&self, |
|
|
|
&self, |
|
|
|
fields: Vec<String>, |
|
|
|
fields: Vec<String>, |
|
|
|
context: &mut dyn Any, |
|
|
|
context: &mut C::Context, |
|
|
|
) -> TemporalResult<Vec<String>> { |
|
|
|
) -> TemporalResult<Vec<String>> { |
|
|
|
match self { |
|
|
|
match self { |
|
|
|
CalendarSlot::Builtin(AnyCalendar::Iso(_)) => Ok(fields), |
|
|
|
CalendarSlot::Builtin(AnyCalendar::Iso(_)) => Ok(fields), |
|
|
@ -799,7 +803,7 @@ impl<C: CalendarProtocol> CalendarSlot<C> { |
|
|
|
&self, |
|
|
|
&self, |
|
|
|
fields: &TemporalFields, |
|
|
|
fields: &TemporalFields, |
|
|
|
additional_fields: &TemporalFields, |
|
|
|
additional_fields: &TemporalFields, |
|
|
|
context: &mut dyn Any, |
|
|
|
context: &mut C::Context, |
|
|
|
) -> TemporalResult<TemporalFields> { |
|
|
|
) -> TemporalResult<TemporalFields> { |
|
|
|
match self { |
|
|
|
match self { |
|
|
|
CalendarSlot::Builtin(_) => fields.merge_fields(additional_fields, self), |
|
|
|
CalendarSlot::Builtin(_) => fields.merge_fields(additional_fields, self), |
|
|
@ -810,7 +814,7 @@ impl<C: CalendarProtocol> CalendarSlot<C> { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// Returns the identifier of this calendar slot.
|
|
|
|
/// Returns the identifier of this calendar slot.
|
|
|
|
pub fn identifier(&self, context: &mut dyn Any) -> TemporalResult<String> { |
|
|
|
pub fn identifier(&self, context: &mut C::Context) -> TemporalResult<String> { |
|
|
|
match self { |
|
|
|
match self { |
|
|
|
CalendarSlot::Builtin(AnyCalendar::Iso(_)) => Ok(String::from("iso8601")), |
|
|
|
CalendarSlot::Builtin(AnyCalendar::Iso(_)) => Ok(String::from("iso8601")), |
|
|
|
CalendarSlot::Builtin(builtin) => Ok(String::from(builtin.debug_name())), |
|
|
|
CalendarSlot::Builtin(builtin) => Ok(String::from(builtin.debug_name())), |
|
|
@ -857,25 +861,27 @@ impl IsoDateSlots for () { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
impl DateTypes<()> for () { |
|
|
|
|
|
|
|
type Date = Date<()>; |
|
|
|
|
|
|
|
type DateTime = DateTime<()>; |
|
|
|
|
|
|
|
type YearMonth = YearMonth<()>; |
|
|
|
|
|
|
|
type MonthDay = MonthDay<()>; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// An empty `CalendarProtocol` implementation on `()`.
|
|
|
|
/// An empty `CalendarProtocol` implementation on `()`.
|
|
|
|
///
|
|
|
|
///
|
|
|
|
/// # Panics
|
|
|
|
/// # Panics
|
|
|
|
///
|
|
|
|
///
|
|
|
|
/// Attempting to use this empty calendar implementation as a valid calendar is an error and will cause a panic.
|
|
|
|
/// Attempting to use this empty calendar implementation as a valid calendar is an error and will cause a panic.
|
|
|
|
impl CalendarProtocol for () { |
|
|
|
impl CalendarProtocol for () { |
|
|
|
type DateLikes = (); |
|
|
|
type Date = Date<()>; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
type DateTime = DateTime<()>; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
type YearMonth = YearMonth<()>; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
type MonthDay = MonthDay<()>; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
type Context = (); |
|
|
|
|
|
|
|
|
|
|
|
fn date_from_fields( |
|
|
|
fn date_from_fields( |
|
|
|
&self, |
|
|
|
&self, |
|
|
|
_: &mut TemporalFields, |
|
|
|
_: &mut TemporalFields, |
|
|
|
_: ArithmeticOverflow, |
|
|
|
_: ArithmeticOverflow, |
|
|
|
_: &mut dyn Any, |
|
|
|
(): &mut (), |
|
|
|
) -> TemporalResult<Date<Self>> { |
|
|
|
) -> TemporalResult<Date<Self>> { |
|
|
|
unreachable!(); |
|
|
|
unreachable!(); |
|
|
|
} |
|
|
|
} |
|
|
@ -884,7 +890,7 @@ impl CalendarProtocol for () { |
|
|
|
&self, |
|
|
|
&self, |
|
|
|
_: &mut TemporalFields, |
|
|
|
_: &mut TemporalFields, |
|
|
|
_: ArithmeticOverflow, |
|
|
|
_: ArithmeticOverflow, |
|
|
|
_: &mut dyn Any, |
|
|
|
(): &mut (), |
|
|
|
) -> TemporalResult<MonthDay<()>> { |
|
|
|
) -> TemporalResult<MonthDay<()>> { |
|
|
|
unreachable!(); |
|
|
|
unreachable!(); |
|
|
|
} |
|
|
|
} |
|
|
@ -893,7 +899,7 @@ impl CalendarProtocol for () { |
|
|
|
&self, |
|
|
|
&self, |
|
|
|
_: &mut TemporalFields, |
|
|
|
_: &mut TemporalFields, |
|
|
|
_: ArithmeticOverflow, |
|
|
|
_: ArithmeticOverflow, |
|
|
|
_: &mut dyn Any, |
|
|
|
(): &mut (), |
|
|
|
) -> TemporalResult<YearMonth<Self>> { |
|
|
|
) -> TemporalResult<YearMonth<Self>> { |
|
|
|
unreachable!() |
|
|
|
unreachable!() |
|
|
|
} |
|
|
|
} |
|
|
@ -903,7 +909,7 @@ impl CalendarProtocol for () { |
|
|
|
_: &Date<Self>, |
|
|
|
_: &Date<Self>, |
|
|
|
_: &Duration, |
|
|
|
_: &Duration, |
|
|
|
_: ArithmeticOverflow, |
|
|
|
_: ArithmeticOverflow, |
|
|
|
_: &mut dyn Any, |
|
|
|
(): &mut (), |
|
|
|
) -> TemporalResult<Date<Self>> { |
|
|
|
) -> TemporalResult<Date<Self>> { |
|
|
|
unreachable!(); |
|
|
|
unreachable!(); |
|
|
|
} |
|
|
|
} |
|
|
@ -913,7 +919,7 @@ impl CalendarProtocol for () { |
|
|
|
_: &Date<()>, |
|
|
|
_: &Date<()>, |
|
|
|
_: &Date<()>, |
|
|
|
_: &Date<()>, |
|
|
|
_: TemporalUnit, |
|
|
|
_: TemporalUnit, |
|
|
|
_: &mut dyn Any, |
|
|
|
(): &mut (), |
|
|
|
) -> TemporalResult<Duration> { |
|
|
|
) -> TemporalResult<Duration> { |
|
|
|
unreachable!(); |
|
|
|
unreachable!(); |
|
|
|
} |
|
|
|
} |
|
|
@ -921,72 +927,72 @@ impl CalendarProtocol for () { |
|
|
|
fn era( |
|
|
|
fn era( |
|
|
|
&self, |
|
|
|
&self, |
|
|
|
_: &CalendarDateLike<Self>, |
|
|
|
_: &CalendarDateLike<Self>, |
|
|
|
_: &mut dyn Any, |
|
|
|
(): &mut (), |
|
|
|
) -> TemporalResult<Option<TinyAsciiStr<16>>> { |
|
|
|
) -> TemporalResult<Option<TinyAsciiStr<16>>> { |
|
|
|
unreachable!(); |
|
|
|
unreachable!(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fn era_year(&self, _: &CalendarDateLike<Self>, _: &mut dyn Any) -> TemporalResult<Option<i32>> { |
|
|
|
fn era_year(&self, _: &CalendarDateLike<Self>, (): &mut ()) -> TemporalResult<Option<i32>> { |
|
|
|
unreachable!(); |
|
|
|
unreachable!(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fn year(&self, _: &CalendarDateLike<Self>, _: &mut dyn Any) -> TemporalResult<i32> { |
|
|
|
fn year(&self, _: &CalendarDateLike<Self>, (): &mut ()) -> TemporalResult<i32> { |
|
|
|
unreachable!(); |
|
|
|
unreachable!(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fn month(&self, _: &CalendarDateLike<Self>, _: &mut dyn Any) -> TemporalResult<u8> { |
|
|
|
fn month(&self, _: &CalendarDateLike<Self>, (): &mut ()) -> TemporalResult<u8> { |
|
|
|
unreachable!(); |
|
|
|
unreachable!(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fn month_code( |
|
|
|
fn month_code( |
|
|
|
&self, |
|
|
|
&self, |
|
|
|
_: &CalendarDateLike<Self>, |
|
|
|
_: &CalendarDateLike<Self>, |
|
|
|
_: &mut dyn Any, |
|
|
|
(): &mut (), |
|
|
|
) -> TemporalResult<TinyAsciiStr<4>> { |
|
|
|
) -> TemporalResult<TinyAsciiStr<4>> { |
|
|
|
unreachable!(); |
|
|
|
unreachable!(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fn day(&self, _: &CalendarDateLike<Self>, _: &mut dyn Any) -> TemporalResult<u8> { |
|
|
|
fn day(&self, _: &CalendarDateLike<Self>, (): &mut ()) -> TemporalResult<u8> { |
|
|
|
unreachable!(); |
|
|
|
unreachable!(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fn day_of_week(&self, _: &CalendarDateLike<Self>, _: &mut dyn Any) -> TemporalResult<u16> { |
|
|
|
fn day_of_week(&self, _: &CalendarDateLike<Self>, (): &mut ()) -> TemporalResult<u16> { |
|
|
|
unreachable!(); |
|
|
|
unreachable!(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fn day_of_year(&self, _: &CalendarDateLike<Self>, _: &mut dyn Any) -> TemporalResult<u16> { |
|
|
|
fn day_of_year(&self, _: &CalendarDateLike<Self>, (): &mut ()) -> TemporalResult<u16> { |
|
|
|
unreachable!(); |
|
|
|
unreachable!(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fn week_of_year(&self, _: &CalendarDateLike<Self>, _: &mut dyn Any) -> TemporalResult<u16> { |
|
|
|
fn week_of_year(&self, _: &CalendarDateLike<Self>, (): &mut ()) -> TemporalResult<u16> { |
|
|
|
unreachable!(); |
|
|
|
unreachable!(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fn year_of_week(&self, _: &CalendarDateLike<Self>, _: &mut dyn Any) -> TemporalResult<i32> { |
|
|
|
fn year_of_week(&self, _: &CalendarDateLike<Self>, (): &mut ()) -> TemporalResult<i32> { |
|
|
|
unreachable!(); |
|
|
|
unreachable!(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fn days_in_week(&self, _: &CalendarDateLike<Self>, _: &mut dyn Any) -> TemporalResult<u16> { |
|
|
|
fn days_in_week(&self, _: &CalendarDateLike<Self>, (): &mut ()) -> TemporalResult<u16> { |
|
|
|
unreachable!(); |
|
|
|
unreachable!(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fn days_in_month(&self, _: &CalendarDateLike<Self>, _: &mut dyn Any) -> TemporalResult<u16> { |
|
|
|
fn days_in_month(&self, _: &CalendarDateLike<Self>, (): &mut ()) -> TemporalResult<u16> { |
|
|
|
unreachable!(); |
|
|
|
unreachable!(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fn days_in_year(&self, _: &CalendarDateLike<Self>, _: &mut dyn Any) -> TemporalResult<u16> { |
|
|
|
fn days_in_year(&self, _: &CalendarDateLike<Self>, (): &mut ()) -> TemporalResult<u16> { |
|
|
|
unreachable!(); |
|
|
|
unreachable!(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fn months_in_year(&self, _: &CalendarDateLike<Self>, _: &mut dyn Any) -> TemporalResult<u16> { |
|
|
|
fn months_in_year(&self, _: &CalendarDateLike<Self>, (): &mut ()) -> TemporalResult<u16> { |
|
|
|
unreachable!(); |
|
|
|
unreachable!(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fn in_leap_year(&self, _: &CalendarDateLike<Self>, _: &mut dyn Any) -> TemporalResult<bool> { |
|
|
|
fn in_leap_year(&self, _: &CalendarDateLike<Self>, (): &mut ()) -> TemporalResult<bool> { |
|
|
|
unreachable!(); |
|
|
|
unreachable!(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fn fields(&self, _: Vec<String>, _: &mut dyn Any) -> TemporalResult<Vec<String>> { |
|
|
|
fn fields(&self, _: Vec<String>, (): &mut ()) -> TemporalResult<Vec<String>> { |
|
|
|
unreachable!(); |
|
|
|
unreachable!(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -994,12 +1000,12 @@ impl CalendarProtocol for () { |
|
|
|
&self, |
|
|
|
&self, |
|
|
|
_: &TemporalFields, |
|
|
|
_: &TemporalFields, |
|
|
|
_: &TemporalFields, |
|
|
|
_: &TemporalFields, |
|
|
|
_: &mut dyn Any, |
|
|
|
(): &mut (), |
|
|
|
) -> TemporalResult<TemporalFields> { |
|
|
|
) -> TemporalResult<TemporalFields> { |
|
|
|
unreachable!(); |
|
|
|
unreachable!(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
fn identifier(&self, _: &mut dyn Any) -> TemporalResult<String> { |
|
|
|
fn identifier(&self, (): &mut ()) -> TemporalResult<String> { |
|
|
|
unreachable!(); |
|
|
|
unreachable!(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|