pub struct Date {
pub year: i32,
pub month: u32,
pub day: u32,
}Expand description
A date value (year, month, day)
Fields§
§year: i32Year
month: u32Month (1-12)
day: u32Day of month (1-31)
Implementations§
Source§impl Date
impl Date
Sourcepub const fn is_leap_year(year: i32) -> bool
pub const fn is_leap_year(year: i32) -> bool
Check if a year is a leap year
Sourcepub const fn days_in_month(year: i32, month: u32) -> u32
pub const fn days_in_month(year: i32, month: u32) -> u32
Get the number of days in a month
Sourcepub const fn day_of_week(&self) -> u32
pub const fn day_of_week(&self) -> u32
Get the day of week (0 = Sunday, 6 = Saturday)
Sourcepub fn format_display(&self) -> String
pub fn format_display(&self) -> String
Format as human-readable (e.g., “January 15, 2024”)
Sourcepub const fn month_name(&self) -> &'static str
pub const fn month_name(&self) -> &'static str
Get month name
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Date
impl<'de> Deserialize<'de> for Date
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Copy for Date
impl Eq for Date
impl StructuralPartialEq for Date
Auto Trait Implementations§
impl Freeze for Date
impl RefUnwindSafe for Date
impl Send for Date
impl Sync for Date
impl Unpin for Date
impl UnsafeUnpin for Date
impl UnwindSafe for Date
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