struct PackedEastAsianTraditionalYearData(u8, u8, u8);Expand description
The struct containing compiled ChineseData
Bit structure (little endian: note that shifts go in the opposite direction!)
Bit: 0 1 2 3 4 5 6 7
Byte 0: [ month lengths .............
Byte 1: .. month lengths ] | [ leap month index ..
Byte 2: ] | [ NY offset ] | unusedWhere the New Year Offset is the offset from ISO Jan 19 of that year for Chinese New Year, the month lengths are stored as 1 = 30, 0 = 29 for each month including the leap month. The largest possible offset is 33, which requires 6 bits of storage.
Tuple Fieldsยง
ยง0: u8ยง1: u8ยง2: u8Implementationsยง
Sourceยงimpl PackedEastAsianTraditionalYearData
impl PackedEastAsianTraditionalYearData
Sourceconst fn earliest_ny(related_iso: i32) -> RataDie
const fn earliest_ny(related_iso: i32) -> RataDie
The first day on which Chinese New Year may occur
According to Reingold & Dershowitz, ch 19.6, Chinese New Year occurs on Jan 21 - Feb 21 inclusive.
Our simple approximation sometimes returns Feb 22.
We allow it to occur as early as January 19 which is the earliest the second new moon could occur after the Winter Solstice if the solstice is pinned to December 20.
Sourceconst fn new(
related_iso: i32,
month_lengths: [bool; 13],
leap_month: Option<u8>,
new_year: RataDie,
) -> Self
const fn new( related_iso: i32, month_lengths: [bool; 13], leap_month: Option<u8>, new_year: RataDie, ) -> Self
It clamps some values to avoid debug assertions on calendrical invariants.
fn new_year(self, related_iso: i32) -> RataDie
fn leap_month(self) -> Option<u8>
fn month_has_30_days(self, month: u8) -> bool
fn last_day_of_month(self, month: u8) -> u16
fn days_in_year(self) -> u16
Trait Implementationsยง
Sourceยงimpl Clone for PackedEastAsianTraditionalYearData
impl Clone for PackedEastAsianTraditionalYearData
Sourceยงfn clone(&self) -> PackedEastAsianTraditionalYearData
fn clone(&self) -> PackedEastAsianTraditionalYearData
1.0.0 (const: unstable) ยท Sourceยงfn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSourceยงimpl Ord for PackedEastAsianTraditionalYearData
impl Ord for PackedEastAsianTraditionalYearData
Sourceยงfn cmp(&self, other: &PackedEastAsianTraditionalYearData) -> Ordering
fn cmp(&self, other: &PackedEastAsianTraditionalYearData) -> 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 PackedEastAsianTraditionalYearData
impl PartialEq for PackedEastAsianTraditionalYearData
Sourceยงfn eq(&self, other: &PackedEastAsianTraditionalYearData) -> bool
fn eq(&self, other: &PackedEastAsianTraditionalYearData) -> bool
self and other values to be equal, and is used by ==.