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

source

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

source§

fn year(&self) -> u8

The Bahá’í Era/Badi year [1 - 221 supported] (year 1 starts 21 March 1844)
source§

fn month(&self) -> BadiMonth

The Badi month [1 - 19] or Ayyám-i-Há
source§

fn day(&self) -> u16

The Badi day [1 - min(19, Ayyám-i-Há days for the year)]
source§

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>

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>

Returns new BadiDateLike with the given year, month, and day (checks input for validity)
source§

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>

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>

Returns new BadiDateLike with the given year and 1-based day_of_year (checks input for validity)
source§

impl Clone for LocalBadiDate

source§

fn clone(&self) -> LocalBadiDate

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for LocalBadiDate

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl FromDateTime for LocalBadiDate

source§

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

source§

fn holy_day(&self) -> Option<BahaiHolyDay>

Gets the holy day for self.day if it is a holy day
source§

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>

Gets the previous holy day, if within the supported date range
source§

impl LocalBadiDateLike for LocalBadiDate

source§

fn timezone(&self) -> Tz

The time zone used for conversion to/from Gregorian dates/times
source§

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

source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl PartialEq for LocalBadiDate

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for LocalBadiDate

source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl ToDateTime for LocalBadiDate

source§

fn start(&self) -> DateTime<Tz>

The moment of sunset of this LocalBadiDate in local time
source§

fn end(&self) -> DateTime<Tz>

The moment of sunset of the end of this / start of next LocalBadiDate in local time
source§

fn midnight(&self) -> DateTime<Tz>

Midnight (in local time) of this BadiDate
source§

impl Eq for LocalBadiDate

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> BadiDateOps<T> for T
where T: BadiDateLike,

source§

fn next_feast(&self) -> T

Returns new BadiDateLike of the next Feast (day 1 of next BadiMonth; skips BadiMonth::AyyamIHa)
source§

fn previous_feast(&self) -> T

Returns new BadiDateLike of the previous Feast (day 1 of BadiMonth::Monthself.month is kept if self.day > 1), skips BadiMonth::AyyamIHa)
source§

fn next_day(&self) -> T

Convenience method to goto next Badi day
source§

fn previous_day(&self) -> T

Convenience method to goto previous Badi day
source§

fn next_month(&self, skip_ayyamiha: bool) -> T

Convenience method to goto next Badi month
source§

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

Add (subtract if months negative) number of months to BadiDateLike Read more
source§

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

Returns new BadiDateLike of the next Naw Ruz (day 1 of BadiMonth::Month(1) of next year)
source§

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> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.