Struct hijri_date::HijriDate

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

Main structure.

  • Contains numeric value of hijri and gregorian dates plus hijri month and day names.
  • Hijri names dosent have suffix, example (day,month,year,..)
  • Gregorian names are denoted with gr or en suffix.

Implementations§

source§

impl HijriDate

source

pub fn day(&self) -> usize

Get the day of the Hijri month

source

pub fn month(&self) -> usize

Get the month of the Hijri year

source

pub fn month_len(&self) -> usize

Get the length of the current Hijri month

source

pub fn year(&self) -> usize

Get the year of the Hijri date

source

pub fn day_name(&self) -> String

Get the name of the day in the Hijri calendar

source

pub fn month_name(&self) -> String

Get the name of the month in the Hijri calendar

source

pub fn day_gr(&self) -> usize

Get the day of the week (Gregorian) corresponding to the Hijri date

source

pub fn month_gr(&self) -> usize

Get the month of the year (Gregorian) corresponding to the Hijri date

source

pub fn year_gr(&self) -> usize

Get the year (Gregorian) corresponding to the Hijri date

source

pub fn day_name_en(&self) -> String

Get the English name of the day in the Hijri calendar

source

pub fn month_name_en(&self) -> String

Get the English name of the month in the Hijri calendar

source

pub fn wasm_to_string(&self) -> String

source

pub fn from_hijri( year: usize, month: usize, day: usize ) -> Result<HijriDate, String>

get data from hijri date

source

pub fn from_gr( year_gr: usize, month_gr: usize, day_gr: usize ) -> Result<HijriDate, String>

get data from gregorian date.

source

pub fn today() -> Self

get data from today’s date.

source

pub fn format(&self, f: &str) -> String

Returns a representation of HijriDate defined by the given formatter

       hijri

    %Y              hijri_year
    %m              hijri_month
    %d              hijri_day
    %D              hijri_day_name
    %M              hijri_month_name
    %l              hijri_month_len

       gregorian

    %gY             gregorian_year
    %gm             gregorian_month
    %gd             gregorian_day
    %gD             gregorian_day_name
    %gM             gregorian_month_name

Trait Implementations§

source§

impl Add<Duration> for HijriDate

§

type Output = HijriDate

The resulting type after applying the + operator.
source§

fn add(self, other: Duration) -> HijriDate

Performs the + operation. Read more
source§

impl Debug for HijriDate

source§

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

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

impl Display for HijriDate

source§

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

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

impl PartialEq<HijriDate> for HijriDate

source§

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

source§

fn partial_cmp(&self, other: &HijriDate) -> 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 Sub<Duration> for HijriDate

§

type Output = HijriDate

The resulting type after applying the - operator.
source§

fn sub(self, other: Duration) -> HijriDate

Performs the - operation. Read more
source§

impl Sub<HijriDate> for HijriDate

§

type Output = Duration

The resulting type after applying the - operator.
source§

fn sub(self, other: HijriDate) -> Duration

Performs the - operation. Read more
source§

impl Eq for HijriDate

source§

impl StructuralEq for HijriDate

source§

impl StructuralPartialEq for HijriDate

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere 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 Twhere 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.