pub enum Matcher {
DayOfWeek(Vec<u32>),
Interval(IntervalMatcher),
Range(RangeMatcher),
Custom(Box<dyn Fn(&NaiveDate) -> bool + Send + Sync>),
}Expand description
Matcher to match dates.
Variants§
DayOfWeek(Vec<u32>)
Match declare days of the week.
Matcher::DayOfWeek(vec![0, 6]) Will match the days of the week that are Sunday and Saturday.
Interval(IntervalMatcher)
Match the included days, except for those before and after the interval.
Matcher::Interval(IntervalMatcher { before: Some(NaiveDate::from_ymd(2020, 1, 2)), after: Some(NaiveDate::from_ymd(2020, 1, 3)), }) Will match the days that are not between 2020-01-02 and 2020-01-03.
Range(RangeMatcher)
Match the days within the range.
Matcher::Range(RangeMatcher { from: Some(NaiveDate::from_ymd(2020, 1, 1)), to: Some(NaiveDate::from_ymd(2020, 1, 3)), }) Will match the days that are between 2020-01-01 and 2020-01-03.
Custom(Box<dyn Fn(&NaiveDate) -> bool + Send + Sync>)
Match dates using a custom function.
let matcher = Matcher::Custom(Box::new(|date: &NaiveDate| { date.day0() < 5 })); Will match first 5 days of each month
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Matcher
impl !UnwindSafe for Matcher
impl Freeze for Matcher
impl Send for Matcher
impl Sync for Matcher
impl Unpin for Matcher
impl UnsafeUnpin for Matcher
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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