From 381cec0ccaf37b9f08db8040b814288188be2e97 Mon Sep 17 00:00:00 2001 From: Gavin Thomas Claugus Date: Sun, 14 Aug 2016 10:21:06 -0400 Subject: [PATCH] libimagentryfilter: parameterize Filter by Entry Signed-off-by: Gavin Thomas Claugus --- libimagentryfilter/src/builtin/bool_filter.rs | 2 +- libimagentryfilter/src/builtin/content/grep.rs | 2 +- libimagentryfilter/src/builtin/content/length/is_over.rs | 2 +- libimagentryfilter/src/builtin/content/length/is_under.rs | 2 +- libimagentryfilter/src/builtin/header/field_eq.rs | 2 +- libimagentryfilter/src/builtin/header/field_exists.rs | 2 +- libimagentryfilter/src/builtin/header/field_grep.rs | 2 +- libimagentryfilter/src/builtin/header/field_gt.rs | 2 +- libimagentryfilter/src/builtin/header/field_isempty.rs | 2 +- libimagentryfilter/src/builtin/header/field_istype.rs | 2 +- libimagentryfilter/src/builtin/header/field_lt.rs | 2 +- libimagentryfilter/src/builtin/header/field_predicate.rs | 2 +- libimagentryfilter/src/builtin/header/version/eq.rs | 2 +- libimagentryfilter/src/builtin/header/version/gt.rs | 2 +- libimagentryfilter/src/builtin/header/version/lt.rs | 2 +- libimagentryfilter/src/builtin/header/version/range.rs | 4 ++-- libimagentryfilter/src/ops/and.rs | 8 ++++---- libimagentryfilter/src/ops/not.rs | 6 +++--- libimagentryfilter/src/ops/or.rs | 8 ++++---- libimagentryfilter/src/tags/mod.rs | 6 +++--- 20 files changed, 31 insertions(+), 31 deletions(-) diff --git a/libimagentryfilter/src/builtin/bool_filter.rs b/libimagentryfilter/src/builtin/bool_filter.rs index d06d0c14..a25f8159 100644 --- a/libimagentryfilter/src/builtin/bool_filter.rs +++ b/libimagentryfilter/src/builtin/bool_filter.rs @@ -12,7 +12,7 @@ impl BoolFilter { } -impl Filter for BoolFilter { +impl Filter for BoolFilter { fn filter(&self, _: &Entry) -> bool { self.0 diff --git a/libimagentryfilter/src/builtin/content/grep.rs b/libimagentryfilter/src/builtin/content/grep.rs index 048f3cdb..de8ade9b 100644 --- a/libimagentryfilter/src/builtin/content/grep.rs +++ b/libimagentryfilter/src/builtin/content/grep.rs @@ -43,7 +43,7 @@ impl ContentGrep { } -impl Filter for ContentGrep { +impl Filter for ContentGrep { fn filter(&self, e: &Entry) -> bool { self.regex.captures(&e.get_content()[..]).is_some() diff --git a/libimagentryfilter/src/builtin/content/length/is_over.rs b/libimagentryfilter/src/builtin/content/length/is_over.rs index 3d318ba3..1ef51ab9 100644 --- a/libimagentryfilter/src/builtin/content/length/is_over.rs +++ b/libimagentryfilter/src/builtin/content/length/is_over.rs @@ -15,7 +15,7 @@ impl ContentLengthIsOver { } -impl Filter for ContentLengthIsOver { +impl Filter for ContentLengthIsOver { fn filter(&self, e: &Entry) -> bool { e.get_content().len() > self.val diff --git a/libimagentryfilter/src/builtin/content/length/is_under.rs b/libimagentryfilter/src/builtin/content/length/is_under.rs index 0f4f595f..5ae7fe7f 100644 --- a/libimagentryfilter/src/builtin/content/length/is_under.rs +++ b/libimagentryfilter/src/builtin/content/length/is_under.rs @@ -15,7 +15,7 @@ impl ContentLengthIsUnder { } -impl Filter for ContentLengthIsUnder { +impl Filter for ContentLengthIsUnder { fn filter(&self, e: &Entry) -> bool { e.get_content().len() < self.val diff --git a/libimagentryfilter/src/builtin/header/field_eq.rs b/libimagentryfilter/src/builtin/header/field_eq.rs index 9d432cc3..457f42b0 100644 --- a/libimagentryfilter/src/builtin/header/field_eq.rs +++ b/libimagentryfilter/src/builtin/header/field_eq.rs @@ -34,7 +34,7 @@ impl FieldEq { } -impl Filter for FieldEq { +impl Filter for FieldEq { fn filter(&self, e: &Entry) -> bool { self.filter.filter(e) diff --git a/libimagentryfilter/src/builtin/header/field_exists.rs b/libimagentryfilter/src/builtin/header/field_exists.rs index 30eaaca2..721b7e0e 100644 --- a/libimagentryfilter/src/builtin/header/field_exists.rs +++ b/libimagentryfilter/src/builtin/header/field_exists.rs @@ -17,7 +17,7 @@ impl FieldExists { } -impl Filter for FieldExists { +impl Filter for FieldExists { fn filter(&self, e: &Entry) -> bool { e.get_header().read(&self.header_field_path[..]).is_ok() diff --git a/libimagentryfilter/src/builtin/header/field_grep.rs b/libimagentryfilter/src/builtin/header/field_grep.rs index 04e45d22..ce312b02 100644 --- a/libimagentryfilter/src/builtin/header/field_grep.rs +++ b/libimagentryfilter/src/builtin/header/field_grep.rs @@ -38,7 +38,7 @@ impl FieldGrep { } -impl Filter for FieldGrep { +impl Filter for FieldGrep { fn filter(&self, e: &Entry) -> bool { self.filter.filter(e) diff --git a/libimagentryfilter/src/builtin/header/field_gt.rs b/libimagentryfilter/src/builtin/header/field_gt.rs index 8ac8046a..02786901 100644 --- a/libimagentryfilter/src/builtin/header/field_gt.rs +++ b/libimagentryfilter/src/builtin/header/field_gt.rs @@ -50,7 +50,7 @@ impl FieldGt { } -impl Filter for FieldGt { +impl Filter for FieldGt { fn filter(&self, e: &Entry) -> bool { self.filter.filter(e) diff --git a/libimagentryfilter/src/builtin/header/field_isempty.rs b/libimagentryfilter/src/builtin/header/field_isempty.rs index 186dc264..e8ea94c3 100644 --- a/libimagentryfilter/src/builtin/header/field_isempty.rs +++ b/libimagentryfilter/src/builtin/header/field_isempty.rs @@ -19,7 +19,7 @@ impl FieldIsEmpty { } -impl Filter for FieldIsEmpty { +impl Filter for FieldIsEmpty { fn filter(&self, e: &Entry) -> bool { e.get_header() diff --git a/libimagentryfilter/src/builtin/header/field_istype.rs b/libimagentryfilter/src/builtin/header/field_istype.rs index c9c59be6..13e6b325 100644 --- a/libimagentryfilter/src/builtin/header/field_istype.rs +++ b/libimagentryfilter/src/builtin/header/field_istype.rs @@ -59,7 +59,7 @@ impl FieldIsType { } -impl Filter for FieldIsType { +impl Filter for FieldIsType { fn filter(&self, e: &Entry) -> bool { self.filter.filter(e) diff --git a/libimagentryfilter/src/builtin/header/field_lt.rs b/libimagentryfilter/src/builtin/header/field_lt.rs index ce1d6aad..9f6fae9a 100644 --- a/libimagentryfilter/src/builtin/header/field_lt.rs +++ b/libimagentryfilter/src/builtin/header/field_lt.rs @@ -50,7 +50,7 @@ impl FieldLt { } -impl Filter for FieldLt { +impl Filter for FieldLt { fn filter(&self, e: &Entry) -> bool { self.filter.filter(e) diff --git a/libimagentryfilter/src/builtin/header/field_predicate.rs b/libimagentryfilter/src/builtin/header/field_predicate.rs index 67de3ac2..1415b901 100644 --- a/libimagentryfilter/src/builtin/header/field_predicate.rs +++ b/libimagentryfilter/src/builtin/header/field_predicate.rs @@ -26,7 +26,7 @@ impl FieldPredicate

{ } -impl Filter for FieldPredicate

{ +impl Filter for FieldPredicate

{ fn filter(&self, e: &Entry) -> bool { e.get_header() diff --git a/libimagentryfilter/src/builtin/header/version/eq.rs b/libimagentryfilter/src/builtin/header/version/eq.rs index a478308c..acf75495 100644 --- a/libimagentryfilter/src/builtin/header/version/eq.rs +++ b/libimagentryfilter/src/builtin/header/version/eq.rs @@ -17,7 +17,7 @@ impl VersionEq { } -impl Filter for VersionEq { +impl Filter for VersionEq { fn filter(&self, e: &Entry) -> bool { e.get_header() diff --git a/libimagentryfilter/src/builtin/header/version/gt.rs b/libimagentryfilter/src/builtin/header/version/gt.rs index e258cfd0..cc5dcade 100644 --- a/libimagentryfilter/src/builtin/header/version/gt.rs +++ b/libimagentryfilter/src/builtin/header/version/gt.rs @@ -17,7 +17,7 @@ impl VersionGt { } -impl Filter for VersionGt { +impl Filter for VersionGt { fn filter(&self, e: &Entry) -> bool { e.get_header() diff --git a/libimagentryfilter/src/builtin/header/version/lt.rs b/libimagentryfilter/src/builtin/header/version/lt.rs index e3ac178e..b7232c4c 100644 --- a/libimagentryfilter/src/builtin/header/version/lt.rs +++ b/libimagentryfilter/src/builtin/header/version/lt.rs @@ -17,7 +17,7 @@ impl VersionLt { } -impl Filter for VersionLt { +impl Filter for VersionLt { fn filter(&self, e: &Entry) -> bool { e.get_header() diff --git a/libimagentryfilter/src/builtin/header/version/range.rs b/libimagentryfilter/src/builtin/header/version/range.rs index 4050a2a9..f049a00f 100644 --- a/libimagentryfilter/src/builtin/header/version/range.rs +++ b/libimagentryfilter/src/builtin/header/version/range.rs @@ -20,7 +20,7 @@ impl VersionInRange { } -impl Filter for VersionInRange { +impl Filter for VersionInRange { fn filter(&self, e: &Entry) -> bool { self.and.filter(e) @@ -40,7 +40,7 @@ impl VersionOutOfRange { } -impl Filter for VersionOutOfRange { +impl Filter for VersionOutOfRange { fn filter(&self, e: &Entry) -> bool { self.not.filter(e) diff --git a/libimagentryfilter/src/ops/and.rs b/libimagentryfilter/src/ops/and.rs index 43465621..a05e83f6 100644 --- a/libimagentryfilter/src/ops/and.rs +++ b/libimagentryfilter/src/ops/and.rs @@ -3,19 +3,19 @@ use libimagstore::store::Entry; use filters::filter::Filter; pub struct And { - a: Box, - b: Box + a: Box>, + b: Box> } impl And { - pub fn new(a: Box, b: Box) -> And { + pub fn new(a: Box>, b: Box>) -> And { And { a: a, b: b } } } -impl Filter for And { +impl Filter for And { fn filter(&self, e: &Entry) -> bool { self.a.filter(e) && self.b.filter(e) diff --git a/libimagentryfilter/src/ops/not.rs b/libimagentryfilter/src/ops/not.rs index 0b32b1b9..452a5fe4 100644 --- a/libimagentryfilter/src/ops/not.rs +++ b/libimagentryfilter/src/ops/not.rs @@ -3,18 +3,18 @@ use libimagstore::store::Entry; use filters::filter::Filter; pub struct Not { - a: Box + a: Box> } impl Not { - pub fn new(a: Box) -> Not { + pub fn new(a: Box>) -> Not { Not { a: a } } } -impl Filter for Not { +impl Filter for Not { fn filter(&self, e: &Entry) -> bool { !self.a.filter(e) diff --git a/libimagentryfilter/src/ops/or.rs b/libimagentryfilter/src/ops/or.rs index 83884a83..1f98ac85 100644 --- a/libimagentryfilter/src/ops/or.rs +++ b/libimagentryfilter/src/ops/or.rs @@ -3,19 +3,19 @@ use libimagstore::store::Entry; use filters::filter::Filter; pub struct Or { - a: Box, - b: Box + a: Box>, + b: Box> } impl Or { - pub fn new(a: Box, b: Box) -> Or { + pub fn new(a: Box>, b: Box>) -> Or { Or { a: a, b: b } } } -impl Filter for Or { +impl Filter for Or { fn filter(&self, e: &Entry) -> bool { self.a.filter(e) || self.b.filter(e) diff --git a/libimagentryfilter/src/tags/mod.rs b/libimagentryfilter/src/tags/mod.rs index 8cc2d16e..162e9824 100644 --- a/libimagentryfilter/src/tags/mod.rs +++ b/libimagentryfilter/src/tags/mod.rs @@ -19,7 +19,7 @@ impl HasTag { } -impl Filter for HasTag { +impl Filter for HasTag { fn filter(&self, e: &Entry) -> bool { e.has_tag(&self.tag).ok().unwrap_or(false) @@ -43,7 +43,7 @@ impl HasAllTags { } -impl Filter for HasAllTags { +impl Filter for HasAllTags { fn filter(&self, e: &Entry) -> bool { e.has_tags(&self.tags).ok().unwrap_or(false) @@ -67,7 +67,7 @@ impl HasAnyTags { } -impl Filter for HasAnyTags { +impl Filter for HasAnyTags { fn filter(&self, e: &Entry) -> bool { self.tags.iter().any(|tag| e.has_tag(tag).ok().unwrap_or(false))