pub trait CalendarProtocol: Clone {
    type Date: IsoDateSlots + GetCalendarSlot<Self> + Clone + Debug;
    type DateTime: IsoDateSlots + GetCalendarSlot<Self> + Clone + Debug;
    type YearMonth: IsoDateSlots + GetCalendarSlot<Self> + Clone + Debug;
    type MonthDay: IsoDateSlots + GetCalendarSlot<Self> + Clone + Debug;
    type Context;

Show 23 methods // Required methods fn date_from_fields( &self, fields: &mut TemporalFields, overflow: ArithmeticOverflow, context: &mut Self::Context ) -> TemporalResult<Date<Self>>; fn year_month_from_fields( &self, fields: &mut TemporalFields, overflow: ArithmeticOverflow, context: &mut Self::Context ) -> TemporalResult<YearMonth<Self>>; fn month_day_from_fields( &self, fields: &mut TemporalFields, overflow: ArithmeticOverflow, context: &mut Self::Context ) -> TemporalResult<MonthDay<Self>>; fn date_add( &self, date: &Date<Self>, duration: &Duration, overflow: ArithmeticOverflow, context: &mut Self::Context ) -> TemporalResult<Date<Self>>; fn date_until( &self, one: &Date<Self>, two: &Date<Self>, largest_unit: TemporalUnit, context: &mut Self::Context ) -> TemporalResult<Duration>; fn era( &self, date_like: &CalendarDateLike<Self>, context: &mut Self::Context ) -> TemporalResult<Option<TinyAsciiStr<16>>>; fn era_year( &self, date_like: &CalendarDateLike<Self>, context: &mut Self::Context ) -> TemporalResult<Option<i32>>; fn year( &self, date_like: &CalendarDateLike<Self>, context: &mut Self::Context ) -> TemporalResult<i32>; fn month( &self, date_like: &CalendarDateLike<Self>, context: &mut Self::Context ) -> TemporalResult<u8>; fn month_code( &self, date_like: &CalendarDateLike<Self>, context: &mut Self::Context ) -> TemporalResult<TinyAsciiStr<4>>; fn day( &self, date_like: &CalendarDateLike<Self>, context: &mut Self::Context ) -> TemporalResult<u8>; fn day_of_week( &self, date_like: &CalendarDateLike<Self>, context: &mut Self::Context ) -> TemporalResult<u16>; fn day_of_year( &self, date_like: &CalendarDateLike<Self>, context: &mut Self::Context ) -> TemporalResult<u16>; fn week_of_year( &self, date_like: &CalendarDateLike<Self>, context: &mut Self::Context ) -> TemporalResult<u16>; fn year_of_week( &self, date_like: &CalendarDateLike<Self>, context: &mut Self::Context ) -> TemporalResult<i32>; fn days_in_week( &self, date_like: &CalendarDateLike<Self>, context: &mut Self::Context ) -> TemporalResult<u16>; fn days_in_month( &self, date_like: &CalendarDateLike<Self>, context: &mut Self::Context ) -> TemporalResult<u16>; fn days_in_year( &self, date_like: &CalendarDateLike<Self>, context: &mut Self::Context ) -> TemporalResult<u16>; fn months_in_year( &self, date_like: &CalendarDateLike<Self>, context: &mut Self::Context ) -> TemporalResult<u16>; fn in_leap_year( &self, date_like: &CalendarDateLike<Self>, context: &mut Self::Context ) -> TemporalResult<bool>; fn fields( &self, fields: Vec<String>, context: &mut Self::Context ) -> TemporalResult<Vec<String>>; fn merge_fields( &self, fields: &TemporalFields, additional_fields: &TemporalFields, context: &mut Self::Context ) -> TemporalResult<TemporalFields>; fn identifier(&self, context: &mut Self::Context) -> TemporalResult<String>;
}
Expand description

A trait for implementing a Builtin Calendar’s Calendar Protocol in Rust.

Required Associated Types§

source

type Date: IsoDateSlots + GetCalendarSlot<Self> + Clone + Debug

A Custom Date Type for an associated CalendarProtocol. Default Date<C>

source

type DateTime: IsoDateSlots + GetCalendarSlot<Self> + Clone + Debug

A Custom DateTime Type for an associated CalendarProtocol. Default DateTime<C>

source

type YearMonth: IsoDateSlots + GetCalendarSlot<Self> + Clone + Debug

A Custom YearMonth Type for an associated CalendarProtocol. Default YearMonth<C>

source

type MonthDay: IsoDateSlots + GetCalendarSlot<Self> + Clone + Debug

A Custom MonthDay Type for an associated CalendarProtocol. Default MonthDay<C>

source

type Context

The context passed to every method of the CalendarProtocol.

Required Methods§

source

fn date_from_fields( &self, fields: &mut TemporalFields, overflow: ArithmeticOverflow, context: &mut Self::Context ) -> TemporalResult<Date<Self>>

Creates a Temporal.PlainDate object from provided fields.

source

fn year_month_from_fields( &self, fields: &mut TemporalFields, overflow: ArithmeticOverflow, context: &mut Self::Context ) -> TemporalResult<YearMonth<Self>>

Creates a Temporal.PlainYearMonth object from the provided fields.

source

fn month_day_from_fields( &self, fields: &mut TemporalFields, overflow: ArithmeticOverflow, context: &mut Self::Context ) -> TemporalResult<MonthDay<Self>>

Creates a Temporal.PlainMonthDay object from the provided fields.

source

fn date_add( &self, date: &Date<Self>, duration: &Duration, overflow: ArithmeticOverflow, context: &mut Self::Context ) -> TemporalResult<Date<Self>>

Returns a Temporal.PlainDate based off an added date.

source

fn date_until( &self, one: &Date<Self>, two: &Date<Self>, largest_unit: TemporalUnit, context: &mut Self::Context ) -> TemporalResult<Duration>

Returns a Temporal.Duration representing the duration between two dates.

source

fn era( &self, date_like: &CalendarDateLike<Self>, context: &mut Self::Context ) -> TemporalResult<Option<TinyAsciiStr<16>>>

Returns the era for a given temporaldatelike.

source

fn era_year( &self, date_like: &CalendarDateLike<Self>, context: &mut Self::Context ) -> TemporalResult<Option<i32>>

Returns the era year for a given temporaldatelike

source

fn year( &self, date_like: &CalendarDateLike<Self>, context: &mut Self::Context ) -> TemporalResult<i32>

Returns the year for a given temporaldatelike

source

fn month( &self, date_like: &CalendarDateLike<Self>, context: &mut Self::Context ) -> TemporalResult<u8>

Returns the month for a given temporaldatelike

source

fn month_code( &self, date_like: &CalendarDateLike<Self>, context: &mut Self::Context ) -> TemporalResult<TinyAsciiStr<4>>

Returns the monthCode for a given temporaldatelike

source

fn day( &self, date_like: &CalendarDateLike<Self>, context: &mut Self::Context ) -> TemporalResult<u8>

Returns the day for a given temporaldatelike

source

fn day_of_week( &self, date_like: &CalendarDateLike<Self>, context: &mut Self::Context ) -> TemporalResult<u16>

Returns a value representing the day of the week for a date.

source

fn day_of_year( &self, date_like: &CalendarDateLike<Self>, context: &mut Self::Context ) -> TemporalResult<u16>

Returns a value representing the day of the year for a given calendar.

source

fn week_of_year( &self, date_like: &CalendarDateLike<Self>, context: &mut Self::Context ) -> TemporalResult<u16>

Returns a value representing the week of the year for a given calendar.

source

fn year_of_week( &self, date_like: &CalendarDateLike<Self>, context: &mut Self::Context ) -> TemporalResult<i32>

Returns the year of a given week.

source

fn days_in_week( &self, date_like: &CalendarDateLike<Self>, context: &mut Self::Context ) -> TemporalResult<u16>

Returns the days in a week for a given calendar.

source

fn days_in_month( &self, date_like: &CalendarDateLike<Self>, context: &mut Self::Context ) -> TemporalResult<u16>

Returns the days in a month for a given calendar.

source

fn days_in_year( &self, date_like: &CalendarDateLike<Self>, context: &mut Self::Context ) -> TemporalResult<u16>

Returns the days in a year for a given calendar.

source

fn months_in_year( &self, date_like: &CalendarDateLike<Self>, context: &mut Self::Context ) -> TemporalResult<u16>

Returns the months in a year for a given calendar.

source

fn in_leap_year( &self, date_like: &CalendarDateLike<Self>, context: &mut Self::Context ) -> TemporalResult<bool>

Returns whether a value is within a leap year according to the designated calendar.

source

fn fields( &self, fields: Vec<String>, context: &mut Self::Context ) -> TemporalResult<Vec<String>>

Return the fields for a value.

source

fn merge_fields( &self, fields: &TemporalFields, additional_fields: &TemporalFields, context: &mut Self::Context ) -> TemporalResult<TemporalFields>

Merge fields based on the calendar and provided values.

source

fn identifier(&self, context: &mut Self::Context) -> TemporalResult<String>

Debug name

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl CalendarProtocol for ()

An empty CalendarProtocol implementation on ().

§Panics

Attempting to use this empty calendar implementation as a valid calendar is an error and will cause a panic.

§

type Date = Date<()>

§

type DateTime = DateTime<()>

§

type YearMonth = YearMonth<()>

§

type MonthDay = MonthDay<()>

§

type Context = ()

source§

fn date_from_fields( &self, _: &mut TemporalFields, _: ArithmeticOverflow, (): &mut () ) -> TemporalResult<Date<Self>>

source§

fn month_day_from_fields( &self, _: &mut TemporalFields, _: ArithmeticOverflow, (): &mut () ) -> TemporalResult<MonthDay<()>>

source§

fn year_month_from_fields( &self, _: &mut TemporalFields, _: ArithmeticOverflow, (): &mut () ) -> TemporalResult<YearMonth<Self>>

source§

fn date_add( &self, _: &Date<Self>, _: &Duration, _: ArithmeticOverflow, (): &mut () ) -> TemporalResult<Date<Self>>

source§

fn date_until( &self, _: &Date<()>, _: &Date<()>, _: TemporalUnit, (): &mut () ) -> TemporalResult<Duration>

source§

fn era( &self, _: &CalendarDateLike<Self>, (): &mut () ) -> TemporalResult<Option<TinyAsciiStr<16>>>

source§

fn era_year( &self, _: &CalendarDateLike<Self>, (): &mut () ) -> TemporalResult<Option<i32>>

source§

fn year(&self, _: &CalendarDateLike<Self>, (): &mut ()) -> TemporalResult<i32>

source§

fn month(&self, _: &CalendarDateLike<Self>, (): &mut ()) -> TemporalResult<u8>

source§

fn month_code( &self, _: &CalendarDateLike<Self>, (): &mut () ) -> TemporalResult<TinyAsciiStr<4>>

source§

fn day(&self, _: &CalendarDateLike<Self>, (): &mut ()) -> TemporalResult<u8>

source§

fn day_of_week( &self, _: &CalendarDateLike<Self>, (): &mut () ) -> TemporalResult<u16>

source§

fn day_of_year( &self, _: &CalendarDateLike<Self>, (): &mut () ) -> TemporalResult<u16>

source§

fn week_of_year( &self, _: &CalendarDateLike<Self>, (): &mut () ) -> TemporalResult<u16>

source§

fn year_of_week( &self, _: &CalendarDateLike<Self>, (): &mut () ) -> TemporalResult<i32>

source§

fn days_in_week( &self, _: &CalendarDateLike<Self>, (): &mut () ) -> TemporalResult<u16>

source§

fn days_in_month( &self, _: &CalendarDateLike<Self>, (): &mut () ) -> TemporalResult<u16>

source§

fn days_in_year( &self, _: &CalendarDateLike<Self>, (): &mut () ) -> TemporalResult<u16>

source§

fn months_in_year( &self, _: &CalendarDateLike<Self>, (): &mut () ) -> TemporalResult<u16>

source§

fn in_leap_year( &self, _: &CalendarDateLike<Self>, (): &mut () ) -> TemporalResult<bool>

source§

fn fields(&self, _: Vec<String>, (): &mut ()) -> TemporalResult<Vec<String>>

source§

fn merge_fields( &self, _: &TemporalFields, _: &TemporalFields, (): &mut () ) -> TemporalResult<TemporalFields>

source§

fn identifier(&self, (): &mut ()) -> TemporalResult<String>

Implementors§