Struct badi_date::LocalBadiDate
source · 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 a different 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>
Returns new
BadiDateLike with a different year, month, and day (checks input for validity)source§fn with_month(&self, month: BadiMonth) -> Result<LocalBadiDate, BadiDateError>
fn with_month(&self, month: BadiMonth) -> Result<LocalBadiDate, BadiDateError>
Returns new
BadiDateLike with a different 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 a different year (checks input for validity)source§impl Clone for LocalBadiDate
impl Clone for LocalBadiDate
source§fn clone(&self) -> LocalBadiDate
fn clone(&self) -> LocalBadiDate
Returns a copy 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 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 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 PartialEq for LocalBadiDate
impl PartialEq for LocalBadiDate
source§fn eq(&self, other: &LocalBadiDate) -> bool
fn eq(&self, other: &LocalBadiDate) -> bool
This method tests for
self and other values to be equal, and is used
by ==.source§impl ToDateTime for LocalBadiDate
impl ToDateTime for LocalBadiDate
impl StructuralPartialEq 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)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