[][src]Struct lunardate::LunarDate

pub struct LunarDate { /* fields omitted */ }

Represents a lunar date

Implementations

impl LunarDate[src]

pub fn new(year: i32, month: u32, day: u32, is_leap_month: bool) -> Self[src]

Construct a new LunarDate struct

pub fn from_solar_date(year: i32, month: u32, day: u32) -> Result<Self, Error>[src]

Construct a new LunarDate from solar date

pub fn from_naive_date(date: &NaiveDate) -> Result<Self, Error>[src]

Construct a new LunarDate from chrono's NaiveDate

pub fn year(&self) -> i32[src]

Return lunar year

pub fn month(&self) -> u32[src]

Return lunar month

pub fn day(&self) -> u32[src]

Return lunar day

pub fn is_leap_month(&self) -> bool[src]

Is leap month?

pub fn to_solar_date(&self) -> Result<NaiveDate, Error>[src]

Convert LunarDate to solar date

pub fn today() -> Result<Self, Error>[src]

Return lunar date of solar date of today

pub fn checked_add(self, rhs: Duration) -> Option<LunarDate>[src]

Adds some duration to the current lunar date

Returns None when it will result in overflow.

pub fn checked_sub(self, rhs: Duration) -> Option<LunarDate>[src]

Subtracts some duration to the current lunar date

Returns None when it will result in overflow.

Trait Implementations

impl Add<Duration> for LunarDate[src]

type Output = LunarDate

The resulting type after applying the + operator.

impl Add<Duration> for LunarDate[src]

type Output = LunarDate

The resulting type after applying the + operator.

impl Clone for LunarDate[src]

impl Copy for LunarDate[src]

impl Debug for LunarDate[src]

impl Eq for LunarDate[src]

impl Hash for LunarDate[src]

impl PartialEq<LunarDate> for LunarDate[src]

impl StructuralEq for LunarDate[src]

impl StructuralPartialEq for LunarDate[src]

impl Sub<Duration> for LunarDate[src]

type Output = LunarDate

The resulting type after applying the - operator.

impl Sub<Duration> for LunarDate[src]

type Output = LunarDate

The resulting type after applying the - operator.

impl Sub<LunarDate> for LunarDate[src]

type Output = Duration

The resulting type after applying the - operator.

impl Sub<NaiveDate> for LunarDate[src]

type Output = Duration

The resulting type after applying the - operator.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.