[−][src]Struct lunardate::LunarDate
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.
fn add(self, rhs: Duration) -> Self::Output
[src]
impl Add<Duration> for LunarDate
[src]
type Output = LunarDate
The resulting type after applying the +
operator.
fn add(self, rhs: Duration) -> Self::Output
[src]
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]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
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.
fn sub(self, rhs: Duration) -> Self::Output
[src]
impl Sub<Duration> for LunarDate
[src]
type Output = LunarDate
The resulting type after applying the -
operator.
fn sub(self, rhs: Duration) -> Self::Output
[src]
impl Sub<LunarDate> for LunarDate
[src]
type Output = Duration
The resulting type after applying the -
operator.
fn sub(self, rhs: LunarDate) -> Self::Output
[src]
impl Sub<NaiveDate> for LunarDate
[src]
Auto Trait Implementations
impl RefUnwindSafe for LunarDate
impl Send for LunarDate
impl Sync for LunarDate
impl Unpin for LunarDate
impl UnwindSafe for LunarDate
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,