diff options
Diffstat (limited to 'src/indicator.rs')
-rw-r--r-- | src/indicator.rs | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/indicator.rs b/src/indicator.rs index 72e1136..fa9bf63 100644 --- a/src/indicator.rs +++ b/src/indicator.rs @@ -1,3 +1,15 @@ +#[cfg(feature = "with-filters")] +use filters::filter::Filter; + +#[cfg(feature = "with-filters")] +use filters::filter::IntoFilter; + +#[cfg(feature = "with-filters")] +use timetype::TimeType; + +#[cfg(feature = "with-filters")] +use chrono::Datelike; + #[derive(Clone, Eq, PartialEq, Ord, PartialOrd, Debug)] pub enum Day { Monday, @@ -64,7 +76,7 @@ pub struct DayFilter(Day); #[cfg(feature = "with-filters")] impl Filter<TimeType> for DayFilter { fn filter(&self, tt: &TimeType) -> bool { - tt.get_moment(|mom| mom.weekday() == self.0.into()).unwrap_or(false) + tt.get_moment().map(|mom| mom.weekday() == self.0.clone().into()).unwrap_or(false) } } @@ -85,7 +97,7 @@ pub struct MonthFilter(Month); #[cfg(feature = "with-filters")] impl Filter<TimeType> for MonthFilter { fn filter(&self, tt: &TimeType) -> bool { - tt.get_moment(|mom| mom.month() == self.0.into()).unwrap_or(false) + tt.get_moment().map(|mom| mom.month() == self.0.clone().into()).unwrap_or(false) } } |