Struct jomini::common::RawDate [−][src]
pub struct RawDate { /* fields omitted */ }
Expand description
Common implementation between the different date and time formats.
Space optimized to only need 4 bytes
It may or may not have an hour component.
Paradox games do not follow any traditional calendar and instead view the world on simpler terms: that every year should be treated as a non-leap year.
Years can be negative but can’t be zero.
An hour component is considered present if it is non-zero. This means that games with hours run on a non-traditional clock from 1-24 instead of the traditional 24 hour clock (0-23).
A raw date has very minimal validation and can support any calendar system as it holds abitrary values for year, month, day, and hours
It is typically recommended to use one of the specialized types: Date, DateHour, or UniformDate as date formats aren’t variable within a game and have less pitfalls.
Implementations
Create a raw date from individual components.
Will return none for an invalid date
Create a raw date from individual components.
Will panic on invalid dates
Return the hour component. Range [1, 24]. If zero, then there is no hour
Parses date components from the following formatted text:
Y.M.D
Y.M.D.H
YYYY.MM.DD.HH
- or any variation of the above
A zero component for the hour is disallowed, so the hour must be omitted when parsing to only a date without a time component.
Unlike Date::parse
, this will not parse the textual form of the
date’s binary representation.
Trait Implementations
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Auto Trait Implementations
impl RefUnwindSafe for RawDate
impl UnwindSafe for RawDate
Blanket Implementations
Mutably borrows from an owned value. Read more