pub(crate) trait CalendarArithmetic: Calendar {
type YearInfo: Copy + Debug;
// Required methods
fn month_days(year: i32, month: u8, year_info: Self::YearInfo) -> u8;
fn months_for_every_year(year: i32, year_info: Self::YearInfo) -> u8;
fn is_leap_year(year: i32, year_info: Self::YearInfo) -> bool;
fn last_month_day_in_year(year: i32, year_info: Self::YearInfo) -> (u8, u8);
// Provided method
fn days_in_provided_year(year: i32, year_info: Self::YearInfo) -> u16 { ... }
}
Required Associated Types§
Required Methods§
fn month_days(year: i32, month: u8, year_info: Self::YearInfo) -> u8
fn months_for_every_year(year: i32, year_info: Self::YearInfo) -> u8
fn is_leap_year(year: i32, year_info: Self::YearInfo) -> bool
fn last_month_day_in_year(year: i32, year_info: Self::YearInfo) -> (u8, u8)
Provided Methods§
sourcefn days_in_provided_year(year: i32, year_info: Self::YearInfo) -> u16
fn days_in_provided_year(year: i32, year_info: Self::YearInfo) -> u16
Calculate the days in a given year Can be overridden with simpler implementations for solar calendars (typically, 366 in leap, 365 otherwise) Leave this as the default for lunar calendars
The name has provided
in it to avoid clashes with Calendar
Object Safety§
This trait is not object safe.