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>

source

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

source

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)

source

pub(crate) fn new_year(self) -> RataDie

source

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.

source

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.

source

pub(crate) fn months_in_year_inner(&self) -> u8

Call months_in_year_with_info on a ChineseBasedDateInner

source

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.

source

pub(crate) fn days_in_month_inner(&self) -> u8

Calls days_in_month on an instance of ChineseBasedDateInner

source

pub(crate) fn fixed_mid_year_from_year(year: i32) -> RataDie

source

pub(crate) fn days_in_year_inner(&self) -> u16

Calls days_in_year on an instance of ChineseBasedDateInner

source

pub(crate) fn days_in_prev_year(&self) -> u16

Gets the days in the previous year

source

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

source

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>

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<C: Debug + CalendarArithmetic> Debug for ChineseBasedDateInner<C>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<C: Ord + CalendarArithmetic> Ord for ChineseBasedDateInner<C>

source§

fn cmp(&self, other: &ChineseBasedDateInner<C>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl<C: PartialEq + CalendarArithmetic> PartialEq for ChineseBasedDateInner<C>

source§

fn eq(&self, other: &ChineseBasedDateInner<C>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<C: PartialOrd + CalendarArithmetic> PartialOrd for ChineseBasedDateInner<C>

source§

fn partial_cmp(&self, other: &ChineseBasedDateInner<C>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<C: CalendarArithmetic> Copy for ChineseBasedDateInner<C>

source§

impl<C: Eq + CalendarArithmetic> Eq for ChineseBasedDateInner<C>

source§

impl<C: CalendarArithmetic> StructuralPartialEq for ChineseBasedDateInner<C>

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> ErasedDestructor for T
where T: 'static,

source§

impl<T> MaybeSendSync for T