diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2017-09-26 18:23:28 +0200 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2017-09-26 18:23:28 +0200 |
commit | fae0a2b502a04b2749f12f7ddb04d72ee86e60dd (patch) | |
tree | ca3ff61f3c564702827ed57d446fdd56db8967c5 | |
parent | ba211d419e78cd9148803868096d98a1de38cce3 (diff) |
Fix feature-gate-caused compiler errors
-rw-r--r-- | src/indicator.rs | 16 | ||||
-rw-r--r-- | src/iter.rs | 4 |
2 files changed, 17 insertions, 3 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) } } diff --git a/src/iter.rs b/src/iter.rs index 9713e51..4e7c18c 100644 --- a/src/iter.rs +++ b/src/iter.rs @@ -381,6 +381,8 @@ mod type_tests { mod type_tests_filter_interface { use super::*; use super::extensions::*; + use filters::filter::Filter; + use filters::filter::IntoFilter; #[test] fn test_compile() { @@ -388,7 +390,7 @@ mod type_tests_filter_interface { let _ = TimeType::today() .yearly(1) .unwrap() - .every(::indicator::Day::Monday.or(::indicator::Month::January)) + .every(::indicator::Day::Monday.into_filter().or(::indicator::Month::January)) .collect::<Vec<_>>(); } } |