From 79c1edcbd120f03542f1d92e1be55e091d75a2d6 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sun, 31 Jul 2016 11:56:12 +0200 Subject: [PATCH] Add BoolFilter --- libimagentryfilter/src/builtin/bool_filter.rs | 22 +++++++++++++++++++ libimagentryfilter/src/builtin/mod.rs | 3 +++ 2 files changed, 25 insertions(+) create mode 100644 libimagentryfilter/src/builtin/bool_filter.rs diff --git a/libimagentryfilter/src/builtin/bool_filter.rs b/libimagentryfilter/src/builtin/bool_filter.rs new file mode 100644 index 00000000..14dbbc8e --- /dev/null +++ b/libimagentryfilter/src/builtin/bool_filter.rs @@ -0,0 +1,22 @@ +use libimagstore::store::Entry; + +use filter::Filter; + +pub struct BoolFilter(bool); + +impl BoolFilter { + + pub fn new(b: bool) -> BoolFilter { + BoolFilter(b) + } + +} + +impl Filter for BoolFilter { + + fn filter(&self, _: &Entry) -> bool { + self.0 + } + +} + diff --git a/libimagentryfilter/src/builtin/mod.rs b/libimagentryfilter/src/builtin/mod.rs index 260f1a1b..be547532 100644 --- a/libimagentryfilter/src/builtin/mod.rs +++ b/libimagentryfilter/src/builtin/mod.rs @@ -1,2 +1,5 @@ pub mod content; pub mod header; + +pub mod bool_filter; +