pub enum RelativeTime {
Directional {
duration: Duration,
dir: TimeDirection,
},
Named(NamedRelativeTime),
Next(RelativeTimeUnit),
Last(RelativeTimeUnit),
}Expand description
Represents a specific point in time offset by some known duration or period, such as “tomorrow”, “now”, “next tuesday”, “3 days after 2/5/2028 at 7:11 PM” etc..
Variants§
Directional
e.g. “3 hours before 18/9/2024 at 4:32 PM”, “7 days and 3 hours after tomorrow”, “5 days ago”, “9 years from now”.
Fields
§
dir: TimeDirectione.g. “from now”, “ago”, “after tomorrow”.
Named(NamedRelativeTime)
e.g. “the day before tomorrow”, “now”, “tomorrow”, “yesterday”.
Next(RelativeTimeUnit)
e.g. “next wednesday”, “next friday”, “next year”.
Last(RelativeTimeUnit)
e.g. “last month”, “last tuesday”, “last year”.
Trait Implementations§
Source§impl Clone for RelativeTime
impl Clone for RelativeTime
Source§fn clone(&self) -> RelativeTime
fn clone(&self) -> RelativeTime
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 RelativeTime
impl Debug for RelativeTime
Source§impl Display for RelativeTime
impl Display for RelativeTime
Source§impl FromStr for RelativeTime
impl FromStr for RelativeTime
Source§impl Hash for RelativeTime
impl Hash for RelativeTime
Source§impl Ord for RelativeTime
impl Ord for RelativeTime
Source§fn cmp(&self, other: &RelativeTime) -> Ordering
fn cmp(&self, other: &RelativeTime) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl Parse for RelativeTime
impl Parse for RelativeTime
fn parse(input: ParseStream<'_>) -> Result<Self>
Source§impl PartialEq for RelativeTime
impl PartialEq for RelativeTime
Source§impl PartialOrd for RelativeTime
impl PartialOrd for RelativeTime
impl Copy for RelativeTime
impl Eq for RelativeTime
impl StructuralPartialEq for RelativeTime
Auto Trait Implementations§
impl Freeze for RelativeTime
impl RefUnwindSafe for RelativeTime
impl Send for RelativeTime
impl Sync for RelativeTime
impl Unpin for RelativeTime
impl UnwindSafe for RelativeTime
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