pub struct EastAsianTraditionalYearData {
packed: PackedEastAsianTraditionalYearData,
related_iso: i32,
}Expand description
Information about a EastAsianTraditional year.
Fields§
§packed: PackedEastAsianTraditionalYearDataContains:
- 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
Implementations§
Source§impl EastAsianTraditionalYearData
impl EastAsianTraditionalYearData
Sourcepub(super) fn simple(
utc_offset: Milliseconds,
related_iso: i32,
) -> EastAsianTraditionalYearData
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
impl EastAsianTraditionalYearData
Sourcepub fn new(
related_iso: i32,
start_day: RataDie,
month_lengths: [bool; 13],
leap_month: Option<u8>,
) -> Self
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.
fn lookup( related_iso: i32, starting_year: i32, data: &[PackedEastAsianTraditionalYearData], ) -> Option<Self>
fn calendrical_calculations<CB: ChineseBased>( related_iso: i32, ) -> EastAsianTraditionalYearData
Trait Implementations§
Source§impl Clone for EastAsianTraditionalYearData
impl Clone for EastAsianTraditionalYearData
Source§fn clone(&self) -> EastAsianTraditionalYearData
fn clone(&self) -> EastAsianTraditionalYearData
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for EastAsianTraditionalYearData
impl Debug for EastAsianTraditionalYearData
Source§impl Ord for EastAsianTraditionalYearData
impl Ord for EastAsianTraditionalYearData
Source§fn cmp(&self, other: &EastAsianTraditionalYearData) -> Ordering
fn cmp(&self, other: &EastAsianTraditionalYearData) -> Ordering
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for EastAsianTraditionalYearData
impl PartialEq for EastAsianTraditionalYearData
Source§fn eq(&self, other: &EastAsianTraditionalYearData) -> bool
fn eq(&self, other: &EastAsianTraditionalYearData) -> bool
self and other values to be equal, and is used by ==.