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>
impl<C: CalendarArithmetic> Copy for ArithmeticDate<C>
impl<C: CalendarArithmetic> Eq for ArithmeticDate<C>
Auto Trait Implementations§
impl<C> Freeze for ArithmeticDate<C>
impl<C> RefUnwindSafe for ArithmeticDate<C>
impl<C> Send for ArithmeticDate<C>
impl<C> Sync for ArithmeticDate<C>
impl<C> Unpin for ArithmeticDate<C>
impl<C> UnwindSafe for ArithmeticDate<C>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)