Struct icu_calendar::chinese_based::ChineseBasedDateInner
source · pub(crate) struct ChineseBasedDateInner<C: CalendarArithmetic>(pub(crate) ArithmeticDate<C>);
Expand description
Chinese-based calendars define DateInner as a calendar-specific struct wrapping ChineseBasedDateInner.
Tuple Fields§
§0: ArithmeticDate<C>
Implementations§
source§impl<C: ChineseBasedWithDataLoading + CalendarArithmetic<YearInfo = ChineseBasedYearInfo>> ChineseBasedDateInner<C>
impl<C: ChineseBasedWithDataLoading + CalendarArithmetic<YearInfo = ChineseBasedYearInfo>> ChineseBasedDateInner<C>
sourcefn chinese_based_date_from_info(
date: RataDie,
year_info: ChineseBasedYearInfo,
extended_year: i32,
) -> ChineseBasedDateInner<C>
fn chinese_based_date_from_info( date: RataDie, year_info: ChineseBasedYearInfo, extended_year: i32, ) -> ChineseBasedDateInner<C>
Get a ChineseBasedDateInner from a fixed date and the cache/extended year associated with it
sourcepub(crate) fn chinese_based_date_from_fixed(
cal: &C,
fixed: RataDie,
iso: ArithmeticDate<Iso>,
) -> ChineseBasedDateInner<C>
pub(crate) fn chinese_based_date_from_fixed( cal: &C, fixed: RataDie, iso: ArithmeticDate<Iso>, ) -> ChineseBasedDateInner<C>
Get a ChineseBasedDateInner from a fixed date, with the related ISO date (passed in to avoid recomputing)
pub(crate) fn new_year(self) -> RataDie
sourcepub(crate) fn fixed_from_chinese_based_date_inner(
date: ChineseBasedDateInner<C>,
) -> RataDie
pub(crate) fn fixed_from_chinese_based_date_inner( date: ChineseBasedDateInner<C>, ) -> RataDie
Get a RataDie from a ChineseBasedDateInner
This finds the RataDie of the new year of the year given, then finds the RataDie of the new moon (beginning of the month) of the month given, then adds the necessary number of days.
sourcepub(crate) fn new_from_ordinals(
year: i32,
month: u8,
day: u8,
year_info: ChineseBasedYearInfo,
) -> Result<ArithmeticDate<C>, CalendarError>
pub(crate) fn new_from_ordinals( year: i32, month: u8, day: u8, year_info: ChineseBasedYearInfo, ) -> Result<ArithmeticDate<C>, CalendarError>
Create a new arithmetic date from a year, month ordinal, and day with bounds checking; returns the result of creating this arithmetic date, as well as a ChineseBasedYearInfo - either the one passed in optionally as an argument, or a new ChineseBasedYearInfo for the given year, month, and day args.
sourcepub(crate) fn months_in_year_inner(&self) -> u8
pub(crate) fn months_in_year_inner(&self) -> u8
Call months_in_year_with_info
on a ChineseBasedDateInner
sourcefn months_in_year_with_info(year_info: ChineseBasedYearInfo) -> u8
fn months_in_year_with_info(year_info: ChineseBasedYearInfo) -> u8
Return the number of months in a given year, which is 13 in a leap year, and 12 in a common year.
Also takes a ChineseBasedYearInfo
argument.
sourcepub(crate) fn days_in_month_inner(&self) -> u8
pub(crate) fn days_in_month_inner(&self) -> u8
Calls days_in_month
on an instance of ChineseBasedDateInner
pub(crate) fn fixed_mid_year_from_year(year: i32) -> RataDie
sourcepub(crate) fn days_in_year_inner(&self) -> u16
pub(crate) fn days_in_year_inner(&self) -> u16
Calls days_in_year on an instance of ChineseBasedDateInner
sourcepub(crate) fn days_in_prev_year(&self) -> u16
pub(crate) fn days_in_prev_year(&self) -> u16
Gets the days in the previous year
sourcepub(crate) fn day_of_year(&self) -> u16
pub(crate) fn day_of_year(&self) -> u16
Calculate the number of days in the year so far for a ChineseBasedDate;
similar to CalendarArithmetic::day_of_year
sourcepub(crate) fn month(&self) -> FormattableMonth
pub(crate) fn month(&self) -> FormattableMonth
The calendar-specific month code represented by date
;
since the Chinese calendar has leap months, an “L” is appended to the month code for
leap months. For example, in a year where an intercalary month is added after the second
month, the month codes for ordinal months 1, 2, 3, 4, 5 would be “M01”, “M02”, “M02L”, “M03”, “M04”.
Trait Implementations§
source§impl<C: CalendarArithmetic> Clone for ChineseBasedDateInner<C>
impl<C: CalendarArithmetic> Clone for ChineseBasedDateInner<C>
source§impl<C: Debug + CalendarArithmetic> Debug for ChineseBasedDateInner<C>
impl<C: Debug + CalendarArithmetic> Debug for ChineseBasedDateInner<C>
source§impl<C: Ord + CalendarArithmetic> Ord for ChineseBasedDateInner<C>
impl<C: Ord + CalendarArithmetic> Ord for ChineseBasedDateInner<C>
source§fn cmp(&self, other: &ChineseBasedDateInner<C>) -> Ordering
fn cmp(&self, other: &ChineseBasedDateInner<C>) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl<C: PartialEq + CalendarArithmetic> PartialEq for ChineseBasedDateInner<C>
impl<C: PartialEq + CalendarArithmetic> PartialEq for ChineseBasedDateInner<C>
source§fn eq(&self, other: &ChineseBasedDateInner<C>) -> bool
fn eq(&self, other: &ChineseBasedDateInner<C>) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl<C: PartialOrd + CalendarArithmetic> PartialOrd for ChineseBasedDateInner<C>
impl<C: PartialOrd + CalendarArithmetic> PartialOrd for ChineseBasedDateInner<C>
source§fn partial_cmp(&self, other: &ChineseBasedDateInner<C>) -> Option<Ordering>
fn partial_cmp(&self, other: &ChineseBasedDateInner<C>) -> Option<Ordering>
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