Struct badi_date::BadiDate

source ·
pub struct BadiDate { /* private fields */ }
Expand description

A structure that holds a date in the Badí‘ (Bahá’í) calendar without time zone or location info

Implementations§

source§

impl BadiDate

source

pub fn new(year: u8, month: BadiMonth, day: u16) -> Result<Self, BadiDateError>

Create a new BadiDate given day, BadiMonth, and year; checks for validity

Trait Implementations§

source§

impl BadiDateLike for BadiDate

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<BadiDate, BadiDateError>

Returns new BadiDateLike with the given day (checks input for validity)
source§

fn with_month(&self, month: BadiMonth) -> Result<BadiDate, BadiDateError>

Returns new BadiDateLike with the given month (checks input for validity)
source§

fn with_year(&self, year: u8) -> Result<Self, BadiDateError>

Returns new BadiDateLike with the given year (checks input for validity)
source§

fn with_ymd( &self, year: u8, month: BadiMonth, day: u16, ) -> Result<BadiDate, BadiDateError>

Returns new BadiDateLike with the given year, month, and day (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 BadiDate

source§

fn clone(&self) -> BadiDate

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 BadiDate

source§

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

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

impl HolyDayProviding for BadiDate

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 PartialEq for BadiDate

source§

fn eq(&self, other: &BadiDate) -> 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 StructuralPartialEq for BadiDate

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<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.