pub struct LocalBadiDate { /* private fields */ }Expand description
A structure that holds a date in the Badí‘ (Bahá’í) calendar with associated time zone and optional coordinates
Implementations§
Source§impl LocalBadiDate
impl LocalBadiDate
Sourcepub fn new(
year: u8,
month: BadiMonth,
day: u16,
timezone: Tz,
coordinates: Option<Coordinates>,
) -> Result<Self, BadiDateError>
pub fn new( year: u8, month: BadiMonth, day: u16, timezone: Tz, coordinates: Option<Coordinates>, ) -> Result<Self, BadiDateError>
Create a new LocalBadiDate given day, BadiMonth, year,
with optionals Coordinates, chrono_tz::Tz; checks for validity
Trait Implementations§
Source§impl BadiDateLike for LocalBadiDate
impl BadiDateLike for LocalBadiDate
Source§fn year(&self) -> u8
fn year(&self) -> u8
The Bahá’í Era/Badi year [1 - 221 supported] (year 1 starts 21 March 1844)
Source§fn day_of_year(&self) -> u16
fn day_of_year(&self) -> u16
The day of the current year (starting with 1 on Naw-Rúz)
Source§fn with_day(&self, day: u16) -> Result<LocalBadiDate, BadiDateError>
fn with_day(&self, day: u16) -> Result<LocalBadiDate, BadiDateError>
Returns new
BadiDateLike with the given day (checks input for validity)Source§fn with_ymd(
&self,
year: u8,
month: BadiMonth,
day: u16,
) -> Result<LocalBadiDate, BadiDateError>
fn with_ymd( &self, year: u8, month: BadiMonth, day: u16, ) -> Result<LocalBadiDate, BadiDateError>
Source§fn with_month(&self, month: BadiMonth) -> Result<LocalBadiDate, BadiDateError>
fn with_month(&self, month: BadiMonth) -> Result<LocalBadiDate, BadiDateError>
Returns new
BadiDateLike with the given month (checks input for validity)Source§fn with_year(&self, year: u8) -> Result<LocalBadiDate, BadiDateError>
fn with_year(&self, year: u8) -> Result<LocalBadiDate, BadiDateError>
Returns new
BadiDateLike with the given year (checks input for validity)Source§fn with_year_and_doy(
&self,
year: u8,
day_of_year: u16,
) -> Result<Self, BadiDateError>
fn with_year_and_doy( &self, year: u8, day_of_year: u16, ) -> Result<Self, BadiDateError>
Source§impl Clone for LocalBadiDate
impl Clone for LocalBadiDate
Source§fn clone(&self) -> LocalBadiDate
fn clone(&self) -> LocalBadiDate
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for LocalBadiDate
impl Debug for LocalBadiDate
Source§impl<'de> Deserialize<'de> for LocalBadiDate
impl<'de> Deserialize<'de> for LocalBadiDate
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for LocalBadiDate
impl Display for LocalBadiDate
Source§impl FromDateTime for LocalBadiDate
impl FromDateTime for LocalBadiDate
Source§fn from_datetime(
date: DateTime<Tz>,
coordinates: Option<Coordinates>,
) -> Result<Self, BadiDateError>
fn from_datetime( date: DateTime<Tz>, coordinates: Option<Coordinates>, ) -> Result<Self, BadiDateError>
Create a new LocalBadiDate given a local time-zoned date and coordinates
Source§impl HolyDayProviding for LocalBadiDate
impl HolyDayProviding for LocalBadiDate
Source§fn holy_day(&self) -> Option<BahaiHolyDay>
fn holy_day(&self) -> Option<BahaiHolyDay>
Gets the holy day for
self.day if it is a holy daySource§fn next_holy_day(&self) -> Result<Self, BadiDateError>
fn next_holy_day(&self) -> Result<Self, BadiDateError>
Gets the next holy day, if within the supported date range
Source§fn previous_holy_day(&self) -> Result<Self, BadiDateError>
fn previous_holy_day(&self) -> Result<Self, BadiDateError>
Gets the previous holy day, if within the supported date range
Source§impl LocalBadiDateLike for LocalBadiDate
impl LocalBadiDateLike for LocalBadiDate
Source§fn coordinates(&self) -> Option<Coordinates>
fn coordinates(&self) -> Option<Coordinates>
The WGS84 GPS coordinates from which sunset is calculated
These MUST match the time zone or sunset times will be wrong!
Source§impl Ord for LocalBadiDate
impl Ord for LocalBadiDate
Source§impl PartialEq for LocalBadiDate
impl PartialEq for LocalBadiDate
Source§impl PartialOrd for LocalBadiDate
impl PartialOrd for LocalBadiDate
Source§impl Serialize for LocalBadiDate
impl Serialize for LocalBadiDate
Source§impl ToDateTime for LocalBadiDate
impl ToDateTime for LocalBadiDate
impl Eq for LocalBadiDate
Auto Trait Implementations§
impl Freeze for LocalBadiDate
impl RefUnwindSafe for LocalBadiDate
impl Send for LocalBadiDate
impl Sync for LocalBadiDate
impl Unpin for LocalBadiDate
impl UnwindSafe for LocalBadiDate
Blanket Implementations§
Source§impl<T> BadiDateOps<T> for Twhere
T: BadiDateLike,
impl<T> BadiDateOps<T> for Twhere
T: BadiDateLike,
Source§fn next_feast(&self) -> T
fn next_feast(&self) -> T
Source§fn previous_feast(&self) -> T
fn previous_feast(&self) -> T
Returns new
BadiDateLike of the previous Feast (day 1 of BadiMonth::Month – self.month is kept if self.day > 1), skips BadiMonth::AyyamIHa)
If self.day == 1, returns the previous month’s Feast.Source§fn previous_or_current_feast(&self) -> T
fn previous_or_current_feast(&self) -> T
Returns new
BadiDateLike of the previous Feast (day 1 of BadiMonth::Month – self.month is kept if self.day > 1), skips BadiMonth::AyyamIHa)
If self.day == 1, returns self.Source§fn previous_day(&self) -> T
fn previous_day(&self) -> T
Convenience method to goto previous Badi day
Source§fn next_month(&self, skip_ayyamiha: bool) -> T
fn next_month(&self, skip_ayyamiha: bool) -> T
Convenience method to goto next Badi month
Source§fn previous_month(&self, skip_ayyamiha: bool) -> T
fn previous_month(&self, skip_ayyamiha: bool) -> T
Convenience method to goto previous Badi month
Source§fn add_months(
&self,
months: i32,
day_change_action: DayChangeAction,
skip_ayyamiha: bool,
) -> T
fn add_months( &self, months: i32, day_change_action: DayChangeAction, skip_ayyamiha: bool, ) -> T
Source§fn add_days(&self, days: i32) -> T
fn add_days(&self, days: i32) -> T
Returns new
BadiDateLike with number of days added (subtracted if negative) (increments month and year accordingly; includes BadiMonth::AyyamIHa)Source§fn next_naw_ruz(&self) -> T
fn next_naw_ruz(&self) -> T
Source§fn previous_naw_ruz(&self) -> T
fn previous_naw_ruz(&self) -> T
Returns new
BadiDateLike of the previous Naw Ruz (day 1 of BadiMonth::Month(1) – self.year is kept if self > current Naw Ruz)Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more