Struct icu_calendar::calendar_arithmetic::ArithmeticDate
source · pub(crate) struct ArithmeticDate<C: CalendarArithmetic> {
pub year: i32,
pub month: u8,
pub day: u8,
pub year_info: C::YearInfo,
marker: PhantomData<C>,
}
Fields§
§year: i32
§month: u8
1-based month of year
day: u8
1-based day of month
year_info: C::YearInfo
Invariant: MUST be updated to match the info for year
whenever year
is updated or set.
marker: PhantomData<C>
Implementations§
source§impl<C: CalendarArithmetic> ArithmeticDate<C>
impl<C: CalendarArithmetic> ArithmeticDate<C>
sourcepub const fn new_unchecked(year: i32, month: u8, day: u8) -> Selfwhere
C: CalendarArithmetic<YearInfo = ()>,
pub const fn new_unchecked(year: i32, month: u8, day: u8) -> Selfwhere
C: CalendarArithmetic<YearInfo = ()>,
Create a new ArithmeticDate
without checking that month
and day
are in bounds.
sourcepub const fn new_unchecked_with_info(
year: i32,
month: u8,
day: u8,
year_info: C::YearInfo,
) -> Self
pub const fn new_unchecked_with_info( year: i32, month: u8, day: u8, year_info: C::YearInfo, ) -> Self
Create a new ArithmeticDate
without checking that month
and day
are in bounds.
pub fn min_date() -> Selfwhere
C: CalendarArithmetic<YearInfo = ()>,
pub fn max_date() -> Selfwhere
C: CalendarArithmetic<YearInfo = ()>,
fn offset_days( &mut self, day_offset: i32, data: &impl PrecomputedDataSource<C::YearInfo>, )
fn offset_months( &mut self, month_offset: i32, data: &impl PrecomputedDataSource<C::YearInfo>, )
pub fn offset_date( &mut self, offset: DateDuration<C>, data: &impl PrecomputedDataSource<C::YearInfo>, )
pub fn until( &self, date2: ArithmeticDate<C>, _largest_unit: DateDurationUnit, _smaller_unit: DateDurationUnit, ) -> DateDuration<C>
pub fn days_in_year(&self) -> u16
pub fn months_in_year(&self) -> u8
pub fn days_in_month(&self) -> u8
pub fn day_of_year(&self) -> u16
pub fn date_from_year_day(year: i32, year_day: u32) -> ArithmeticDate<C>where
C: CalendarArithmetic<YearInfo = ()>,
pub fn day_of_month(&self) -> DayOfMonth
sourcepub fn month(&self) -> FormattableMonth
pub fn month(&self) -> FormattableMonth
The types::FormattableMonth
for the current month (with month code) for a solar calendar
Lunar calendars should not use this method and instead manually implement a month code
resolver.
Originally “solar_month” but renamed because it can be used for some lunar calendars
Returns “und” if run with months that are out of bounds for the current calendar.
sourcepub fn new_from_codes<C2: Calendar>(
cal: &C2,
year: i32,
month_code: MonthCode,
day: u8,
) -> Result<Self, CalendarError>where
C: CalendarArithmetic<YearInfo = ()>,
pub fn new_from_codes<C2: Calendar>(
cal: &C2,
year: i32,
month_code: MonthCode,
day: u8,
) -> Result<Self, CalendarError>where
C: CalendarArithmetic<YearInfo = ()>,
Construct a new arithmetic date from a year, month code, and day, bounds checking the month and day Originally (new_from_solar_codes) but renamed because it works for some lunar calendars
sourcepub fn new_from_ordinals(
year: i32,
month: u8,
day: u8,
) -> Result<Self, CalendarError>where
C: CalendarArithmetic<YearInfo = ()>,
pub fn new_from_ordinals(
year: i32,
month: u8,
day: u8,
) -> Result<Self, CalendarError>where
C: CalendarArithmetic<YearInfo = ()>,
Construct a new arithmetic date from a year, month ordinal, and day, bounds checking the month and day Originally (new_from_solar_ordinals) but renamed because it works for some lunar calendars
sourcepub fn new_from_ordinals_with_info(
year: i32,
month: u8,
day: u8,
info: C::YearInfo,
) -> Result<Self, CalendarError>
pub fn new_from_ordinals_with_info( year: i32, month: u8, day: u8, info: C::YearInfo, ) -> Result<Self, CalendarError>
Construct a new arithmetic date from a year, month ordinal, and day, bounds checking the month and day
Trait Implementations§
source§impl<C: CalendarArithmetic> Clone for ArithmeticDate<C>
impl<C: CalendarArithmetic> Clone for ArithmeticDate<C>
source§impl<C: Debug + CalendarArithmetic> Debug for ArithmeticDate<C>
impl<C: Debug + CalendarArithmetic> Debug for ArithmeticDate<C>
source§impl<C: CalendarArithmetic> Hash for ArithmeticDate<C>
impl<C: CalendarArithmetic> Hash for ArithmeticDate<C>
source§impl<C: CalendarArithmetic> Ord for ArithmeticDate<C>
impl<C: CalendarArithmetic> Ord for ArithmeticDate<C>
source§impl<C: CalendarArithmetic> PartialEq for ArithmeticDate<C>
impl<C: CalendarArithmetic> PartialEq for ArithmeticDate<C>
source§impl<C: CalendarArithmetic> PartialOrd for ArithmeticDate<C>
impl<C: CalendarArithmetic> PartialOrd for ArithmeticDate<C>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more