pub struct Date {
pub year: u16,
pub month: u8,
pub day: u8,
}Expand description
A calendar date with year, month, and day components.
Represents the date portion of a TOML datetime value. Field ranges are validated during parsing:
year: 0–9999month: 1–12day: 1–31 (upper bound depends on month and leap year rules)
§Examples
use toml_spanner::{Arena, DateTime};
let dt: DateTime = "2026-03-15".parse().unwrap();
let date = dt.date().unwrap();
assert_eq!(date.year, 2026);
assert_eq!(date.month, 3);
assert_eq!(date.day, 15);Fields§
§year: u16Calendar year (0–9999).
month: u8Month of the year (1–12).
day: u8Day of the month (1–31).
Trait Implementations§
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