#[repr(u32)]pub enum MonthInGame {
MorningStar = 0,
SunsDawn = 1,
FirstSeed = 2,
RainsHand = 3,
SecondSeed = 4,
Midyear = 5,
SunsHeight = 6,
LastSeed = 7,
Hearthfire = 8,
Frostfall = 9,
SunsDusk = 10,
EveningStar = 11,
}
Expand description
Represents the months of the year.
The internal values correspond to 0-based month indexing:
0
→ January (MorningStar
)1
→ February (SunsDawn
)11
→ December (EveningStar
)
§Example
let month = MonthInGame::FirstSeed;
assert_eq!(month.as_str(), "First Seed");
Variants§
MorningStar = 0
SunsDawn = 1
FirstSeed = 2
RainsHand = 3
SecondSeed = 4
Midyear = 5
SunsHeight = 6
LastSeed = 7
Hearthfire = 8
Frostfall = 9
SunsDusk = 10
EveningStar = 11
Implementations§
Source§impl MonthInGame
impl MonthInGame
Sourcepub const fn as_str(&self) -> &'static str
pub const fn as_str(&self) -> &'static str
Returns the string representation of the month name.
§Example
let month = MonthInGame::Midyear;
assert_eq!(month.as_str(), "Midyear");
Sourcepub const fn from_u32(month: u32) -> Option<Self>
pub const fn from_u32(month: u32) -> Option<Self>
Converts a u32
value into the corresponding MonthInGame
enum.
Returns None
if the value is out of range (0..=11
).
§Example
assert_eq!(MonthInGame::from_u32(0), Some(MonthInGame::MorningStar)); // January
assert_eq!(MonthInGame::from_u32(11), Some(MonthInGame::EveningStar)); // December
assert_eq!(MonthInGame::from_u32(12), None); // Out of range
assert_eq!(MonthInGame::from_u32(100), None); // Out of range
Trait Implementations§
Source§impl Clone for MonthInGame
impl Clone for MonthInGame
Source§fn clone(&self) -> MonthInGame
fn clone(&self) -> MonthInGame
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for MonthInGame
impl Debug for MonthInGame
Source§impl Default for MonthInGame
impl Default for MonthInGame
Source§fn default() -> MonthInGame
fn default() -> MonthInGame
Returns the “default value” for a type. Read more
Source§impl Display for MonthInGame
impl Display for MonthInGame
Source§impl From<MonthInGame> for MonthIndex
impl From<MonthInGame> for MonthIndex
Source§fn from(month: MonthInGame) -> Self
fn from(month: MonthInGame) -> Self
Converts to this type from the input type.
Source§impl Hash for MonthInGame
impl Hash for MonthInGame
Source§impl Ord for MonthInGame
impl Ord for MonthInGame
Source§fn cmp(&self, other: &MonthInGame) -> Ordering
fn cmp(&self, other: &MonthInGame) -> Ordering
1.21.0 · 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 PartialEq for MonthInGame
impl PartialEq for MonthInGame
Source§impl PartialOrd for MonthInGame
impl PartialOrd for MonthInGame
Source§impl TryFrom<MonthIndex> for MonthInGame
impl TryFrom<MonthIndex> for MonthInGame
impl Copy for MonthInGame
impl Eq for MonthInGame
impl StructuralPartialEq for MonthInGame
Auto Trait Implementations§
impl Freeze for MonthInGame
impl RefUnwindSafe for MonthInGame
impl Send for MonthInGame
impl Sync for MonthInGame
impl Unpin for MonthInGame
impl UnwindSafe for MonthInGame
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