pub struct Date { /* private fields */ }Expand description
A date value representing a calendar date (year, month, day) without time information. Always interpreted in SVTC.
Internally stored as days since Unix epoch (1970-01-01).
Implementations§
Source§impl Date
impl Date
pub fn new(year: i32, month: u32, day: u32) -> Option<Self>
pub fn from_ymd(year: i32, month: u32, day: u32) -> Result<Self, String>
pub fn today() -> Self
pub fn year(&self) -> i32
pub fn month(&self) -> u32
pub fn day(&self) -> u32
Sourcepub fn to_days_since_epoch(&self) -> i32
pub fn to_days_since_epoch(&self) -> i32
Convert to days since Unix epoch for storage
Sourcepub fn from_days_since_epoch(days: i32) -> Option<Self>
pub fn from_days_since_epoch(days: i32) -> Option<Self>
Create from days since Unix epoch for storage
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
Source§impl Ord for Date
impl Ord for Date
Source§impl PartialOrd for Date
impl PartialOrd for Date
Source§impl TryFromValue for Date
impl TryFromValue for Date
Source§fn try_from_value(value: &Value) -> Result<Self, FromValueError>
fn try_from_value(value: &Value) -> Result<Self, FromValueError>
Attempt to extract a value of this type from a Value. Read more
impl Copy for Date
impl Eq for Date
impl IsDate for Date
impl IsTemporal 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 UnwindSafe for Date
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)