pub struct MonthCode(pub TinyAsciiStr<4>);Expand description
Representation of a month in a year
Month codes typically look like M01, M02, etc, but can handle leap months
(M03L) in lunar calendars. Solar calendars will have codes between M01 and M12
potentially with an M13 for epagomenal months. Check the docs for a particular calendar
for details on what its month codes are.
Month codes are shared with Temporal, see Temporal proposal.
Tuple Fields§
§0: TinyAsciiStr<4>Implementations§
Source§impl MonthCode
impl MonthCode
Sourcepub fn get_normal_if_leap(self) -> Option<MonthCode>
👎Deprecated since 2.1.0
pub fn get_normal_if_leap(self) -> Option<MonthCode>
Sourcepub fn parsed(self) -> Option<(u8, bool)>
👎Deprecated since 2.1.0
pub fn parsed(self) -> Option<(u8, bool)>
Get the month number and whether or not it is leap from the month code
Sourcepub fn new_normal(number: u8) -> Option<Self>
pub fn new_normal(number: u8) -> Option<Self>
Construct a “normal” month code given a number (“Mxx”).
Returns an error for months greater than 99
Trait Implementations§
Source§impl AsULE for MonthCode
impl AsULE for MonthCode
Source§type ULE = TinyAsciiStr<4>
type ULE = TinyAsciiStr<4>
The ULE type corresponding to
Self. Read moreSource§fn to_unaligned(self) -> TinyAsciiStr<4>
fn to_unaligned(self) -> TinyAsciiStr<4>
Source§fn from_unaligned(u: TinyAsciiStr<4>) -> Self
fn from_unaligned(u: TinyAsciiStr<4>) -> Self
Source§impl Ord for MonthCode
impl Ord for MonthCode
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for MonthCode
impl PartialOrd for MonthCode
Source§impl<'a> ZeroMapKV<'a> for MonthCode
Available on crate feature alloc only.
impl<'a> ZeroMapKV<'a> for MonthCode
Available on crate feature
alloc only.impl Copy for MonthCode
impl Eq for MonthCode
impl StructuralPartialEq for MonthCode
Auto Trait Implementations§
impl Freeze for MonthCode
impl RefUnwindSafe for MonthCode
impl Send for MonthCode
impl Sync for MonthCode
impl Unpin for MonthCode
impl UnsafeUnpin for MonthCode
impl UnwindSafe for MonthCode
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