Skip to main content

EastAsianTraditionalYearData

Struct EastAsianTraditionalYearData 

Source
pub struct EastAsianTraditionalYearData {
    packed: PackedEastAsianTraditionalYearData,
    related_iso: i32,
}
Expand description

Information about a EastAsianTraditional year.

Fields§

§packed: PackedEastAsianTraditionalYearData

Contains:

  • length of each month in the year
  • whether or not there is a leap month, and which month it is
  • the date of Chinese New Year in the related ISO year
§related_iso: i32

Implementations§

Source§

impl EastAsianTraditionalYearData

Source

pub(super) fn simple( utc_offset: Milliseconds, related_iso: i32, ) -> EastAsianTraditionalYearData

A fast approximation for the Chinese calendar, inspired by the píngqì (平氣) rule used in the Ming dynasty.

Stays anchored in the Gregorian calendar, even as the Gregorian calendar drifts from the seasons in the distant future and distant past.

Source§

impl EastAsianTraditionalYearData

Source

pub fn new( related_iso: i32, start_day: RataDie, month_lengths: [bool; 13], leap_month: Option<u8>, ) -> Self

Creates EastAsianTraditionalYearData from the given parts.

start_day is the date for the first day of the year, see Date::to_rata_die to obtain a RataDie from a Date in an arbitrary calendar.

leap_month is the ordinal number of the leap month, for example if a year has months 1, 2, 3, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, the leap_month would be Some(4).

month_lengths[n - 1] is true if the nth month has 30 days, and false otherwise. The leap month does not necessarily have the same number of days as the previous month, which is why this has length 13. In non-leap years, the last value is ignored.

Source

fn lookup( related_iso: i32, starting_year: i32, data: &[PackedEastAsianTraditionalYearData], ) -> Option<Self>

Source

fn calendrical_calculations<CB: ChineseBased>( related_iso: i32, ) -> EastAsianTraditionalYearData

Source

fn new_year(self) -> RataDie

Get the new year R.D.

Trait Implementations§

Source§

impl Clone for EastAsianTraditionalYearData

Source§

fn clone(&self) -> EastAsianTraditionalYearData

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for EastAsianTraditionalYearData

Source§

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

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

impl Ord for EastAsianTraditionalYearData

Source§

fn cmp(&self, other: &EastAsianTraditionalYearData) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

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

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

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

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

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

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

impl PartialEq for EastAsianTraditionalYearData

Source§

fn eq(&self, other: &EastAsianTraditionalYearData) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for EastAsianTraditionalYearData

Source§

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

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · Source§

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

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 (const: unstable) · Source§

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

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl ToExtendedYear for EastAsianTraditionalYearData

Source§

impl Copy for EastAsianTraditionalYearData

Source§

impl Eq for EastAsianTraditionalYearData

Source§

impl StructuralPartialEq for EastAsianTraditionalYearData

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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,

Source§

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>,

Source§

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>,

Source§

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,