pub enum TemporalValue {
Date(NaiveDate),
DateTime(DateTime<Utc>),
Duration(Duration),
}Expand description
Represents a temporal value (Date, DateTime, or Duration)
Variants§
Date(NaiveDate)
A date without time (ISO8601: YYYY-MM-DD)
DateTime(DateTime<Utc>)
A datetime with timezone
Duration(Duration)
A duration/interval
Implementations§
Source§impl TemporalValue
impl TemporalValue
Sourcepub fn parse_date(date_str: &str) -> Result<Self, String>
pub fn parse_date(date_str: &str) -> Result<Self, String>
Parse an ISO8601 date string (YYYY-MM-DD)
Sourcepub fn parse_datetime(datetime_str: &str) -> Result<Self, String>
pub fn parse_datetime(datetime_str: &str) -> Result<Self, String>
Parse an ISO8601 datetime string
Sourcepub fn parse_duration(duration_str: &str) -> Result<Self, String>
pub fn parse_duration(duration_str: &str) -> Result<Self, String>
Parse an ISO8601 duration string
Sourcepub fn add_duration(
&self,
duration: &TemporalValue,
) -> Result<TemporalValue, String>
pub fn add_duration( &self, duration: &TemporalValue, ) -> Result<TemporalValue, String>
Add a duration to this temporal value
Sourcepub fn subtract_duration(
&self,
duration: &TemporalValue,
) -> Result<TemporalValue, String>
pub fn subtract_duration( &self, duration: &TemporalValue, ) -> Result<TemporalValue, String>
Subtract a duration from this temporal value
Sourcepub fn difference(&self, other: &TemporalValue) -> Result<TemporalValue, String>
pub fn difference(&self, other: &TemporalValue) -> Result<TemporalValue, String>
Get the difference between two temporal values
Sourcepub fn compare(&self, other: &TemporalValue) -> Result<Ordering, String>
pub fn compare(&self, other: &TemporalValue) -> Result<Ordering, String>
Compare two temporal values
Sourcepub fn is_before(&self, other: &TemporalValue) -> Result<bool, String>
pub fn is_before(&self, other: &TemporalValue) -> Result<bool, String>
Check if this is before another temporal value
Sourcepub fn is_after(&self, other: &TemporalValue) -> Result<bool, String>
pub fn is_after(&self, other: &TemporalValue) -> Result<bool, String>
Check if this is after another temporal value
Sourcepub fn start_of_day(&self) -> Result<TemporalValue, String>
pub fn start_of_day(&self) -> Result<TemporalValue, String>
Get start of day for a date
Sourcepub fn end_of_day(&self) -> Result<TemporalValue, String>
pub fn end_of_day(&self) -> Result<TemporalValue, String>
Get end of day for a date
Sourcepub fn to_iso8601(&self) -> String
pub fn to_iso8601(&self) -> String
Format as ISO8601 string
Trait Implementations§
Source§impl Clone for TemporalValue
impl Clone for TemporalValue
Source§fn clone(&self) -> TemporalValue
fn clone(&self) -> TemporalValue
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TemporalValue
impl Debug for TemporalValue
Source§impl Display for TemporalValue
impl Display for TemporalValue
Source§impl PartialEq for TemporalValue
impl PartialEq for TemporalValue
impl Eq for TemporalValue
impl StructuralPartialEq for TemporalValue
Auto Trait Implementations§
impl Freeze for TemporalValue
impl RefUnwindSafe for TemporalValue
impl Send for TemporalValue
impl Sync for TemporalValue
impl Unpin for TemporalValue
impl UnwindSafe for TemporalValue
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