Struct hoi4save::Date [−][src]
Struct specialized to parsing, formatting, and manipulating dates in games
A game date does not follow any traditional calendar and instead views the world on simpler terms: that every year should be treated as a non-leap year.
Implementations
impl Date
[src]
pub fn new(year: i16, month: u8, day: u8, hour: u8) -> Option<Self>
[src]
pub fn year(&self) -> i16
[src]
Year of the date
pub fn month(&self) -> u8
[src]
Month of the date
pub fn day(&self) -> u8
[src]
Day of the date
pub fn hour(&self) -> u8
[src]
Day of the date
pub fn parse_from_str<T: AsRef<str>>(s: T) -> Option<Self>
[src]
Parses a string and returns a new Date if valid.
pub fn days_until(&self, other: &Date) -> i32
[src]
Returns the number of days between two dates
pub fn add_days(&self, days: i32) -> Date
[src]
Return a new date that is the given number of days in the future from the current date
Will panic on overflow or underflow.
pub fn from_binary(mut s: i32) -> Option<Self>
[src]
Decodes a date from a number that had been parsed from binary data
pub fn iso_8601(&self) -> String
[src]
Formats a date in the ISO 8601 format: YYYY-MM-DD
pub fn game_fmt(&self) -> String
[src]
Formats a date in the game format: Y.M.D
Trait Implementations
impl Clone for Date
[src]
impl Copy for Date
[src]
impl Debug for Date
[src]
impl<'de> Deserialize<'de> for Date
[src]
fn deserialize<D>(deserializer: D) -> Result<Date, D::Error> where
D: Deserializer<'de>,
[src]
D: Deserializer<'de>,
impl Eq for Date
[src]
impl Ord for Date
[src]
fn cmp(&self, other: &Date) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl PartialEq<Date> for Date
[src]
impl PartialOrd<Date> for Date
[src]
fn partial_cmp(&self, other: &Date) -> Option<Ordering>
[src]
#[must_use]pub fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]pub fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl Serialize for Date
[src]
impl StructuralEq for Date
[src]
impl StructuralPartialEq for Date
[src]
Auto Trait Implementations
impl RefUnwindSafe for Date
[src]
impl Send for Date
[src]
impl Sync for Date
[src]
impl Unpin for Date
[src]
impl UnwindSafe for Date
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,