Struct datetime::YearMonth
[−]
[src]
pub struct YearMonth { pub year: Year, pub month: Month, }
A month-year pair.
Fields
year: Year
month: Month
Methods
impl YearMonth
[src]
fn day_count(&self) -> i8
Returns the number of days in this month. This can be definitely known, as the paired year determines whether it’s a leap year, so there’s no chance of being caught out by February.
Examples
use datetime::Year; use datetime::Month::February; assert_eq!(Year(2000).month(February).day_count(), 29); assert_eq!(Year(1900).month(February).day_count(), 28);
fn days<S: DaySpan>(&self, span: S) -> MonthDays
Returns an iterator over a continuous span of days in this month,
returning LocalDate
values.
Examples
use datetime::Year; use datetime::Month::September; let ym = Year(1999).month(September); assert_eq!(ym.days(..).count(), 30); assert_eq!(ym.days(10 ..).count(), 21); assert_eq!(ym.days(10 .. 20).count(), 10); assert_eq!(ym.days(.. 20).count(), 19);
fn day(&self, day: i8) -> Result<LocalDate, Error>
Returns a LocalDate
based on the day of this month.
This is just a short-cut for the LocalDate::ymd
constructor.
Trait Implementations
impl PartialEq for YearMonth
[src]
fn eq(&self, __arg_0: &YearMonth) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &YearMonth) -> bool
This method tests for !=
.
impl Debug for YearMonth
[src]
impl Copy for YearMonth
[src]
impl Clone for YearMonth
[src]
fn clone(&self) -> YearMonth
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more