pub enum DatePattern {
AtOrAfter(MillisSinceEpoch),
Before(MillisSinceEpoch),
}
Expand description
Represents an range of dates that may be matched against.
Variants§
AtOrAfter(MillisSinceEpoch)
Represents all dates at or after the given instant.
Before(MillisSinceEpoch)
Represents all dates before, but not including, the given instant.
Implementations§
Source§impl DatePattern
impl DatePattern
Sourcepub fn from_str_kind<Tz: TimeZone>(
s: &str,
kind: &str,
now: DateTime<Tz>,
) -> Result<DatePattern, DatePatternParseError>
pub fn from_str_kind<Tz: TimeZone>( s: &str, kind: &str, now: DateTime<Tz>, ) -> Result<DatePattern, DatePatternParseError>
Parses a string into a DatePattern.
-
s
is the string to be parsed. -
kind
must be either “after” or “before”. This determines whether the pattern will match dates after or before the parsed date. -
now
is the user’s current time. This is aDateTime<Tz>
because knowledge of offset changes is needed to correctly process relative times like “today”. For example, California entered DST on March 10, 2024, shifting clocks from UTC-8 to UTC-7 at 2:00 AM. If the pattern “today” was parsed at noon on that day, it should be interpreted as 2024-03-10T00:00:00-08:00 even though the current offset is -07:00.
Trait Implementations§
Source§impl Clone for DatePattern
impl Clone for DatePattern
Source§fn clone(&self) -> DatePattern
fn clone(&self) -> DatePattern
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for DatePattern
impl Debug for DatePattern
Source§impl PartialEq for DatePattern
impl PartialEq for DatePattern
impl Copy for DatePattern
impl Eq for DatePattern
impl StructuralPartialEq for DatePattern
Auto Trait Implementations§
impl Freeze for DatePattern
impl RefUnwindSafe for DatePattern
impl Send for DatePattern
impl Sync for DatePattern
impl Unpin for DatePattern
impl UnwindSafe for DatePattern
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more