[][src]Struct gregorian::Year

pub struct Year { /* fields omitted */ }

A calendar year.

All dates in the library use the proleptic Gregorian calendar with a year 0.

Implementations

impl Year[src]

pub const fn new(year: i16) -> Self[src]

Create a new year from a number.

pub const fn to_number(self) -> i16[src]

Get the year number.

pub const fn has_leap_day(self) -> bool[src]

Check if the year has a leap day.

In the proleptic Gregorian calendar with a year 0, the year 0 has a leap day.

pub const fn total_days(self) -> u16[src]

Get the total number of days in the year.

For leap years, this is 366. For other years, this is 365.

pub const fn next(self) -> Self[src]

Get the next year.

pub const fn prev(self) -> Self[src]

Get the previous year.

pub const fn with_month(self, month: Month) -> YearMonth[src]

Combine the year with a month to create a YearMonth.

pub const fn with_day_of_year(
    self,
    day_of_year: u16
) -> Result<Date, InvalidDayOfYear>
[src]

Combine the year with a day-of-year to create a Date.

Day-of-year numbers start a 1 for January 1.

pub const fn first_month(self) -> YearMonth[src]

Get the first month of the year as YearMonth.

pub const fn last_month(self) -> YearMonth[src]

Get the last month of the year as YearMonth.

pub const fn months(self) -> [YearMonth; 12][src]

Get all months of the year as YearMonth array.

pub const fn first_day(self) -> Date[src]

Get the first day of the year as Date.

pub const fn last_day(self) -> Date[src]

Get the last day of the year as Date.

Trait Implementations

impl Add<i16> for Year[src]

type Output = Self

The resulting type after applying the + operator.

impl AddAssign<i16> for Year[src]

impl Clone for Year[src]

impl Copy for Year[src]

impl Debug for Year[src]

impl Display for Year[src]

impl Eq for Year[src]

impl From<Year> for i16[src]

impl From<i16> for Year[src]

impl Hash for Year[src]

impl Ord for Year[src]

impl PartialEq<Year> for Year[src]

impl PartialEq<i16> for Year[src]

impl PartialOrd<Year> for Year[src]

impl PartialOrd<i16> for Year[src]

impl StructuralEq for Year[src]

impl StructuralPartialEq for Year[src]

impl Sub<i16> for Year[src]

type Output = Self

The resulting type after applying the - operator.

impl SubAssign<i16> for Year[src]

Auto Trait Implementations

impl RefUnwindSafe for Year

impl Send for Year

impl Sync for Year

impl Unpin for Year

impl UnwindSafe for Year

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> ToString for T where
    T: Display + ?Sized
[src]

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.