Struct lunardate::LunarDate [−][src]
pub struct LunarDate { /* fields omitted */ }
Represents a lunar date
Methods
impl LunarDate
[src]
impl LunarDate
pub fn new(year: i32, month: u32, day: u32, is_leap_month: bool) -> Self
[src]
pub fn new(year: i32, month: u32, day: u32, is_leap_month: bool) -> Self
Construct a new LunarDate
struct
pub fn from_solar_date(year: i32, month: u32, day: u32) -> Result<Self, Error>
[src]
pub fn from_solar_date(year: i32, month: u32, day: u32) -> Result<Self, Error>
Construct a new LunarDate
from solar date
pub fn from_naive_date(date: &NaiveDate) -> Result<Self, Error>
[src]
pub fn from_naive_date(date: &NaiveDate) -> Result<Self, Error>
Construct a new LunarDate
from chrono
's NaiveDate
pub fn year(&self) -> i32
[src]
pub fn year(&self) -> i32
Return lunar year
pub fn month(&self) -> u32
[src]
pub fn month(&self) -> u32
Return lunar month
pub fn day(&self) -> u32
[src]
pub fn day(&self) -> u32
Return lunar day
pub fn is_leap_month(&self) -> bool
[src]
pub fn is_leap_month(&self) -> bool
Is leap month?
pub fn to_solar_date(&self) -> Result<NaiveDate, Error>
[src]
pub fn to_solar_date(&self) -> Result<NaiveDate, Error>
Convert LunarDate
to solar date
pub fn today() -> Result<Self, Error>
[src]
pub fn today() -> Result<Self, Error>
Return lunar date of solar date of today
Trait Implementations
impl Debug for LunarDate
[src]
impl Debug for LunarDate
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Clone for LunarDate
[src]
impl Clone for LunarDate
fn clone(&self) -> LunarDate
[src]
fn clone(&self) -> LunarDate
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Copy for LunarDate
[src]
impl Copy for LunarDate
impl PartialEq for LunarDate
[src]
impl PartialEq for LunarDate
fn eq(&self, other: &LunarDate) -> bool
[src]
fn eq(&self, other: &LunarDate) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &LunarDate) -> bool
[src]
fn ne(&self, other: &LunarDate) -> bool
This method tests for !=
.
impl Eq for LunarDate
[src]
impl Eq for LunarDate
impl Hash for LunarDate
[src]
impl Hash for LunarDate
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Add<Duration> for LunarDate
[src]
impl Add<Duration> for LunarDate
type Output = LunarDate
The resulting type after applying the +
operator.
fn add(self, rhs: Duration) -> Self::Output
[src]
fn add(self, rhs: Duration) -> Self::Output
Performs the +
operation.
impl Add<Duration> for LunarDate
[src]
impl Add<Duration> for LunarDate
type Output = LunarDate
The resulting type after applying the +
operator.
fn add(self, rhs: Duration) -> Self::Output
[src]
fn add(self, rhs: Duration) -> Self::Output
Performs the +
operation.
impl Sub<Duration> for LunarDate
[src]
impl Sub<Duration> for LunarDate
type Output = LunarDate
The resulting type after applying the -
operator.
fn sub(self, rhs: Duration) -> Self::Output
[src]
fn sub(self, rhs: Duration) -> Self::Output
Performs the -
operation.
impl Sub<Duration> for LunarDate
[src]
impl Sub<Duration> for LunarDate
type Output = LunarDate
The resulting type after applying the -
operator.
fn sub(self, rhs: Duration) -> Self::Output
[src]
fn sub(self, rhs: Duration) -> Self::Output
Performs the -
operation.
impl Sub<LunarDate> for LunarDate
[src]
impl Sub<LunarDate> for LunarDate
type Output = Duration
The resulting type after applying the -
operator.
fn sub(self, rhs: LunarDate) -> Self::Output
[src]
fn sub(self, rhs: LunarDate) -> Self::Output
Performs the -
operation.
impl Sub<NaiveDate> for LunarDate
[src]
impl Sub<NaiveDate> for LunarDate