Enum Month

enum Month

Months of the year.

Variants

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

Implementations

impl Month

const fn length(self: Self, year: i32) -> u8

Get the number of days in the month of a given year.

# use time::Month;
assert_eq!(Month::February.length(2020), 29);
const fn previous(self: Self) -> Self

Get the previous month.

# use time::Month;
assert_eq!(Month::January.previous(), Month::December);
const fn next(self: Self) -> Self

Get the next month.

# use time::Month;
assert_eq!(Month::January.next(), Month::February);
const fn nth_next(self: Self, n: u8) -> Self

Get n-th next month.

# use time::Month;
assert_eq!(Month::January.nth_next(4), Month::May);
assert_eq!(Month::July.nth_next(9), Month::April);
const fn nth_prev(self: Self, n: u8) -> Self

Get n-th previous month.

# use time::Month;
assert_eq!(Month::January.nth_prev(4), Month::September);
assert_eq!(Month::July.nth_prev(9), Month::October);

impl Clone for Month

fn clone(self: &Self) -> Month

impl Copy for Month

impl Debug for Month

fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result

impl Display for Month

fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result

impl Eq for Month

impl Freeze for Month

impl FromStr for Month

fn from_str(s: &str) -> Result<Self, <Self as >::Err>

impl Hash for Month

fn hash<__H: $crate::hash::Hasher>(self: &Self, state: &mut __H)

impl Ord for Month

fn cmp(self: &Self, other: &Month) -> Ordering

impl PartialEq for Month

fn eq(self: &Self, other: &Month) -> bool

impl PartialOrd for Month

fn partial_cmp(self: &Self, other: &Month) -> Option<Ordering>

impl RefUnwindSafe for Month

impl Send for Month

impl SmartDisplay for Month

fn metadata(self: &Self, _: FormatterOptions) -> Metadata<'_, Self>
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result

impl StructuralPartialEq for Month

impl Sync for Month

impl TryFrom for Month

fn try_from(value: u8) -> Result<Self, <Self as >::Error>

impl Unpin for Month

impl UnsafeUnpin for Month

impl UnwindSafe for Month

impl<T> Any for Month

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for Month

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for Month

fn borrow_mut(self: &mut Self) -> &mut T

impl<T> CloneToUninit for Month

unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)

impl<T> From for Month

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToOwned for Month

fn to_owned(self: &Self) -> T
fn clone_into(self: &Self, target: &mut T)

impl<T> ToString for Month

fn to_string(self: &Self) -> String

impl<T, U> Into for Month

fn into(self: Self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom for Month

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for Month

fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>