Enum timelang::RelativeTime
source · 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
Fields
§
dir: TimeDirection
e.g. “from now”, “ago”, “after tomorrow”.
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”.
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 copy 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§fn eq(&self, other: &RelativeTime) -> bool
fn eq(&self, other: &RelativeTime) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for RelativeTime
impl PartialOrd for RelativeTime
source§fn partial_cmp(&self, other: &RelativeTime) -> Option<Ordering>
fn partial_cmp(&self, other: &RelativeTime) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Copy for RelativeTime
impl Eq for RelativeTime
impl StructuralEq for RelativeTime
impl StructuralPartialEq for RelativeTime
Auto Trait Implementations§
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