summaryrefslogtreecommitdiffstats
path: root/src/ops
diff options
context:
space:
mode:
Diffstat (limited to 'src/ops')
-rw-r--r--src/ops/and.rs8
-rw-r--r--src/ops/bool.rs9
-rw-r--r--src/ops/not.rs8
-rw-r--r--src/ops/or.rs8
-rw-r--r--src/ops/xor.rs8
5 files changed, 5 insertions, 36 deletions
diff --git a/src/ops/and.rs b/src/ops/and.rs
index 545df83..92937ec 100644
--- a/src/ops/and.rs
+++ b/src/ops/and.rs
@@ -20,10 +20,4 @@ impl<T, U> And<T, U> {
}
-impl<I, T: Filter<I>, U: Filter<I>> Filter<I> for And<T, U> {
-
- fn filter(&self, e: &I) -> bool {
- self.a.filter(e) && self.b.filter(e)
- }
-
-}
+impl_operators!(And, self e { self.a.filter(e) && self.b.filter(e) }, T, U);
diff --git a/src/ops/bool.rs b/src/ops/bool.rs
index fa33da2..3c32271 100644
--- a/src/ops/bool.rs
+++ b/src/ops/bool.rs
@@ -19,14 +19,6 @@ impl Bool {
}
-impl<I> Filter<I> for Bool {
-
- fn filter(&self, _: &I) -> bool {
- self.b
- }
-
-}
-
impl From<bool> for Bool {
fn from(b: bool) -> Bool {
@@ -35,3 +27,4 @@ impl From<bool> for Bool {
}
+impl_operators!(Bool, self e { self.b }, );
diff --git a/src/ops/not.rs b/src/ops/not.rs
index bddb7ed..e0f10f5 100644
--- a/src/ops/not.rs
+++ b/src/ops/not.rs
@@ -19,10 +19,4 @@ impl<T> Not<T> {
}
-impl<I, T: Filter<I>> Filter<I> for Not<T> {
-
- fn filter(&self, e: &I) -> bool {
- !self.a.filter(e)
- }
-
-}
+impl_operators!(Not, self e { !self.a.filter(e) }, T);
diff --git a/src/ops/or.rs b/src/ops/or.rs
index d27e152..c4819ba 100644
--- a/src/ops/or.rs
+++ b/src/ops/or.rs
@@ -20,10 +20,4 @@ impl<T, U> Or<T, U> {
}
-impl<I, T: Filter<I>, U: Filter<I>> Filter<I> for Or<T, U> {
-
- fn filter(&self, e: &I) -> bool {
- self.a.filter(e) || self.b.filter(e)
- }
-
-}
+impl_operators!(Or, self e { self.a.filter(e) || self.b.filter(e) }, T, U);
diff --git a/src/ops/xor.rs b/src/ops/xor.rs
index 32f264b..a41b59f 100644
--- a/src/ops/xor.rs
+++ b/src/ops/xor.rs
@@ -20,10 +20,4 @@ impl<T, U> XOr<T, U> {
}
-impl<I, T: Filter<I>, U: Filter<I>> Filter<I> for XOr<T, U> {
-
- fn filter(&self, e: &I) -> bool {
- self.a.filter(e) ^ self.b.filter(e)
- }
-
-}
+impl_operators!(XOr, self e { self.a.filter(e) ^ self.b.filter(e) }, T, U);