[−][src]Struct heca_lib::HebrewYear
HebrewYear holds data on a given year. Hypothetically, it's faster to get multiple HebrewDates from an existing HebrewYear rather than generating each one on its own.
Methods
impl HebrewYear
[src]
pub fn new(year: u64) -> Result<HebrewYear, ConversionError>
[src]
pub fn year(&self) -> u64
[src]
pub fn get_hebrew_date(
&self,
month: HebrewMonth,
day: u8
) -> Result<HebrewDate, ConversionError>
[src]
&self,
month: HebrewMonth,
day: u8
) -> Result<HebrewDate, ConversionError>
Returns a HebrewDate from the current year and a supplied month and day.
Arguments:
month
- The Hebrew month.
day
- The day of the Hebrew month.
pub fn get_holidays(
&self,
location: Location,
yt_types: &[TorahReadingType]
) -> SmallVec<[TorahReadingDay; 256]>
[src]
&self,
location: Location,
yt_types: &[TorahReadingType]
) -> SmallVec<[TorahReadingDay; 256]>
Returns all the days when the Torah is read.
Arguments
location
- Specify if you're looking for the calendar in Israel or in the Diaspora. Is
relevent as there's one day of Yom Tov in Israel and two outside. This also affects the
Weekly parsha if the last day of Pesach or the second day of Shavuos is on Shabbos, when in
Israel we move to the next Parsha while outside we're still reading the Yom Tov reading.
yt_types
- An array containing TorahReadingType
. This should be used as a flag to
specify which types of Torah readings you want to list.
Returns
Returns an array (or a vec) of days.
Note
This may unsorted, and is returned under no defined order.
Examples
extern crate heca_lib; use heca_lib::prelude::*; use heca_lib::{HebrewDate, HebrewYear}; let year = HebrewYear::new(5779).unwrap(); let shabbosim = year.get_holidays(Location::Chul, &[TorahReadingType::Shabbos, TorahReadingType::SpecialParsha, TorahReadingType::Chol, TorahReadingType::YomTov]); let mut count = 0; for s in shabbosim.into_iter() { if s.name() == TorahReading::Shabbos(Parsha::Bereishis) { assert_eq!(s.day(), HebrewDate::from_ymd(5779,HebrewMonth::Tishrei, 27).unwrap()); count += 1; } else if s.name() == TorahReading::SpecialParsha(SpecialParsha::Zachor) { assert_eq!(s.day(), HebrewDate::from_ymd(5779,HebrewMonth::Adar2, 9).unwrap()); count += 1; } else if s.name() == TorahReading::Chol(Chol::Chanukah1) { assert_eq!(s.day(), HebrewDate::from_ymd(5779,HebrewMonth::Kislev, 25).unwrap()); count += 1; } else if s.name() == TorahReading::YomTov(YomTov::Shavuos1) { assert_eq!(s.day(), HebrewDate::from_ymd(5779,HebrewMonth::Sivan, 6).unwrap()); count += 1; } } assert_eq!(count,4);
Auto Trait Implementations
impl Send for HebrewYear
impl Sync for HebrewYear
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,