pub enum Keviyah {
Show 14 variants
בחג = 0,
בשה = 1,
גכה = 2,
הכז = 3,
השא = 4,
זחא = 5,
זשג = 6,
בחה = 7,
בשז = 8,
גכז = 9,
החא = 10,
השג = 11,
זחג = 12,
זשה = 13,
}
Expand description
The Keviyah (קביעה) of a year. A year may be one of fourteen types, categorized by the day of week of the new year (the first number, 1 = Sunday), the type of year (Deficient, Regular, Complete), and the day of week of the first day of Passover. The last segment disambiguates between cases that have the same first two but differ on whether they are leap years (since Passover happens in Nisan, after the leap month Adar).
The discriminant values of these entries are according to the positions these keviyot appear in the Four Gates table, with the leap year ones being offset by 7. We don’t directly rely on this property but it is useful for potential bitpacking, and we use it as a way to double-check that the four gates code is set up correctly. We do directly rely on the leap-keviyot being after the regular ones (and starting with בחה) in is_leap.
For people unsure if their editor supports bidirectional text, the first Keviyah (2D3) is Bet (ב), Ḥet (ח), Gimel (ג).
(The Hebrew values are used in code for two reasons: firstly, Rust identifiers can’t start with a number, and secondly, sources differ on the Latin alphanumeric notation but use identical Hebrew notation)
Variants§
בחג = 0
2D3
בשה = 1
2C5
גכה = 2
3R5
הכז = 3
5R7
השא = 4
5C1
זחא = 5
7D1
זשג = 6
7C3
בחה = 7
2D5
בשז = 8
2C7
גכז = 9
3R7
החא = 10
5D1
השג = 11
5C3
זחג = 12
7D3
זשה = 13
7C5
Implementations§
source§impl Keviyah
impl Keviyah
sourcepub fn year_type(self) -> YearType
pub fn year_type(self) -> YearType
Get the type of year for this Keviyah.
Comes from the second letter in this Keviyah: ח = D, כ = R, ש = C
sourcepub fn start_of_year(self) -> StartOfYear
pub fn start_of_year(self) -> StartOfYear
Get the day of the new year for this Keviyah
Comes from the first letter in this Keviyah: ב = 2 = Monday, ג = 3 = Tuesday, ה = 5 = Thursday, ז = 7 = Saturday
sourcefn normalized_ordinal_month(self, ordinal_month: u8) -> Option<u8>
fn normalized_ordinal_month(self, ordinal_month: u8) -> Option<u8>
Normalize the ordinal month to the “month number” in the year (ignoring leap months), i.e. Adar and Adar II are both represented by 6.
Returns None if given the index of Adar I (6 in a leap year)
sourcepub fn month_len(self, ordinal_month: u8) -> u8
pub fn month_len(self, ordinal_month: u8) -> u8
Given an ordinal, civil month (1-indexed month starting at Tishrei) return its length
sourcepub fn days_preceding(self, ordinal_month: u8) -> u16
pub fn days_preceding(self, ordinal_month: u8) -> u16
Get the number of days preceding this month
sourcepub fn month_day_for(self, day: u16) -> (u8, u8)
pub fn month_day_for(self, day: u16) -> (u8, u8)
Given a day of the year, return the ordinal month and day as (month, day).
sourcepub fn last_month_day_in_year(self) -> (u8, u8)
pub fn last_month_day_in_year(self) -> (u8, u8)
Return the last ordinal month and day in this year as (month, day)
sourcepub fn year_info(self, h_year: i32) -> YearInfo
pub fn year_info(self, h_year: i32) -> YearInfo
Given the hebrew year for this Keviyah, calculate the YearInfo
sourcepub fn year_length(self) -> u16
pub fn year_length(self) -> u16
How many days are in this year
sourcepub fn from_integer(integer: u8) -> Self
pub fn from_integer(integer: u8) -> Self
Construct this from an integer between 0 and 13
Potentially useful for bitpacking
Trait Implementations§
source§impl Ord for Keviyah
impl Ord for Keviyah
source§impl PartialEq for Keviyah
impl PartialEq for Keviyah
source§impl PartialOrd for Keviyah
impl PartialOrd for Keviyah
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