#[non_exhaustive]pub enum DateExpr {
Now,
Relative(RelativeDate, Option<TimeExpr>),
DayRef(Direction, Weekday, Option<TimeExpr>),
Absolute(AbsoluteDate, Option<TimeExpr>),
TimeOnly(TimeExpr),
Epoch(EpochValue),
Offset(Direction, Vec<DurationComponent>),
OffsetFrom(Direction, Vec<DurationComponent>, Box<DateExpr>),
Arithmetic(Box<DateExpr>, ArithOp, Vec<DurationComponent>),
Range(RangeExpr),
Boundary(BoundaryKind),
}Expand description
Top-level AST node representing a parsed date expression.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Now
“now” or empty input
Relative(RelativeDate, Option<TimeExpr>)
“today”, “tomorrow”, “yesterday”, “overmorrow” with optional time
DayRef(Direction, Weekday, Option<TimeExpr>)
“next/last/this friday” with optional time
Absolute(AbsoluteDate, Option<TimeExpr>)
“2025-01-01”, “24 March 2025” with optional time
TimeOnly(TimeExpr)
“15:30” (time only, resolved against today)
Epoch(EpochValue)
“@1735689600”, “@1735689600ms”
Offset(Direction, Vec<DurationComponent>)
“in 3 days”, “3 hours ago”
OffsetFrom(Direction, Vec<DurationComponent>, Box<DateExpr>)
“3 hours ago from next friday”
Arithmetic(Box<DateExpr>, ArithOp, Vec<DurationComponent>)
“tomorrow + 3 hours” – compound arithmetic
Range(RangeExpr)
“last week”, “this month”, “next year”, “Q3 2025” – period expressions
Boundary(BoundaryKind)
Boundary keyword: eod, sow, etc.
Trait Implementations§
impl StructuralPartialEq for DateExpr
Auto Trait Implementations§
impl Freeze for DateExpr
impl RefUnwindSafe for DateExpr
impl Send for DateExpr
impl Sync for DateExpr
impl Unpin for DateExpr
impl UnsafeUnpin for DateExpr
impl UnwindSafe for DateExpr
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