[][src]Enum gregorian::Month

#[repr(u8)]pub enum Month {
    January,
    February,
    March,
    April,
    May,
    June,
    July,
    August,
    September,
    October,
    November,
    December,
}

A month on the Gregorian calendar.

Variants

January
February
March
April
May
June
July
August
September
October
November
December

Implementations

impl Month[src]

pub const fn new(month: u8) -> Result<Self, InvalidMonthNumber>[src]

Create a new month from a month number.

The number must be in the range 1-12 (inclusive).

pub unsafe fn new_unchecked(month: u8) -> Self[src]

Create a new month from a month number, without checking for validity.

Safety

The month number will be transmuted directly to Month. If the number is not a valid enum variant, this triggers undefined behaviour.

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

Get the month number in the range 1-12.

pub fn with_year(self, year: impl Into<Year>) -> YearMonth[src]

Combine the month with a year to create a YearMonth.

pub const fn wrapping_add(self, count: i8) -> Self[src]

Add a number of months, wrapping back to January after December.

pub const fn wrapping_sub(self, count: i8) -> Self[src]

Add a number of months, wrapping back to December after January.

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

Get the next month, wrapping back to January after December.

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

Get the previous month, wrapping back to December after January.

Trait Implementations

impl Clone for Month[src]

impl Copy for Month[src]

impl Debug for Month[src]

impl Display for Month[src]

impl Eq for Month[src]

impl From<Month> for u8[src]

impl Hash for Month[src]

impl Ord for Month[src]

impl PartialEq<Month> for Month[src]

impl PartialEq<u8> for Month[src]

impl PartialOrd<Month> for Month[src]

impl StructuralEq for Month[src]

impl StructuralPartialEq for Month[src]

impl TryFrom<u8> for Month[src]

type Error = InvalidMonthNumber

The type returned in the event of a conversion error.

Auto Trait Implementations

impl RefUnwindSafe for Month

impl Send for Month

impl Sync for Month

impl Unpin for Month

impl UnwindSafe for Month

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.