Enum Month
#[repr(u8)]pub enum Month {
January = 1,
February = 2,
March = 3,
April = 4,
May = 5,
June = 6,
July = 7,
August = 8,
September = 9,
October = 10,
November = 11,
December = 12,
}
Expand description
Months of the year.
Variants§
January = 1
February = 2
March = 3
April = 4
May = 5
June = 6
July = 7
August = 8
September = 9
October = 10
November = 11
December = 12
Implementations§
§impl Month
impl Month
pub const fn length(self, year: i32) -> u8
pub const fn length(self, year: i32) -> u8
Get the number of days in the month of a given year.
assert_eq!(Month::February.length(2020), 29);
pub const fn previous(self) -> Month
pub const fn previous(self) -> Month
Get the previous month.
assert_eq!(Month::January.previous(), Month::December);
pub const fn next(self) -> Month
pub const fn next(self) -> Month
Get the next month.
assert_eq!(Month::January.next(), Month::February);
Trait Implementations§
§impl<'a> Deserialize<'a> for Month
impl<'a> Deserialize<'a> for Month
§fn deserialize<D>(
deserializer: D,
) -> Result<Month, <D as Deserializer<'a>>::Error>where
D: Deserializer<'a>,
fn deserialize<D>(
deserializer: D,
) -> Result<Month, <D as Deserializer<'a>>::Error>where
D: Deserializer<'a>,
Deserialize this value from the given Serde deserializer. Read more
§impl Serialize for Month
impl Serialize for Month
§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
§impl SmartDisplay for Month
impl SmartDisplay for Month
§fn metadata(&self, _: FormatterOptions) -> Metadata<'_, Month>
fn metadata(&self, _: FormatterOptions) -> Metadata<'_, Month>
Compute any information needed to format the value. This must, at a minimum, determine the
width of the value before any padding is added by the formatter. Read more
impl Copy for Month
impl Eq for Month
impl StructuralPartialEq for Month
Auto Trait Implementations§
impl Freeze for Month
impl RefUnwindSafe for Month
impl Send for Month
impl Sync for Month
impl Unpin for Month
impl UnwindSafe for Month
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.