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 Freeze for Matcher
impl !RefUnwindSafe for Matcher
impl Send for Matcher
impl Sync for Matcher
impl Unpin for Matcher
impl !UnwindSafe 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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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