pub struct SimpleDate {
pub year: i32,
pub month: u8,
pub day: u8,
}Expand description
A plain calendar date — year/month/day, no time-of-day or timezone.
Fields§
§year: i32§month: u81-12.
day: u81-31.
Implementations§
Source§impl SimpleDate
impl SimpleDate
pub fn new(year: i32, month: u8, day: u8) -> Self
pub fn is_leap_year(year: i32) -> bool
pub fn days_in_month(year: i32, month: u8) -> u8
Sourcepub fn day_of_week(year: i32, month: u8, day: u8) -> u8
pub fn day_of_week(year: i32, month: u8, day: u8) -> u8
0 = Sunday .. 6 = Saturday, via Zeller’s congruence (Gregorian).
pub fn prev_month(self) -> Self
pub fn next_month(self) -> Self
pub fn prev_year(self) -> Self
pub fn next_year(self) -> Self
Sourcepub fn month_ordinal(self) -> i32
pub fn month_ordinal(self) -> i32
Absolute month index (year*12 + month-1) — a monotone integer used to animate month-to-month slides and to compare/step months cheaply.
Sourcepub fn from_month_ordinal(ord: i32) -> Self
pub fn from_month_ordinal(ord: i32) -> Self
Inverse of Self::month_ordinal — day defaults to 1.
Trait Implementations§
Source§impl Clone for SimpleDate
impl Clone for SimpleDate
Source§fn clone(&self) -> SimpleDate
fn clone(&self) -> SimpleDate
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for SimpleDate
Source§impl Debug for SimpleDate
impl Debug for SimpleDate
impl Eq for SimpleDate
Source§impl Ord for SimpleDate
impl Ord for SimpleDate
Source§fn cmp(&self, other: &SimpleDate) -> Ordering
fn cmp(&self, other: &SimpleDate) -> Ordering
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 PartialEq for SimpleDate
impl PartialEq for SimpleDate
Source§impl PartialOrd for SimpleDate
impl PartialOrd for SimpleDate
impl StructuralPartialEq for SimpleDate
Auto Trait Implementations§
impl Freeze for SimpleDate
impl RefUnwindSafe for SimpleDate
impl Send for SimpleDate
impl Sync for SimpleDate
impl Unpin for SimpleDate
impl UnsafeUnpin for SimpleDate
impl UnwindSafe for SimpleDate
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