diff --git a/libimagentryfilter/src/builtin/content/length/is_over.rs b/libimagentryfilter/src/builtin/content/length/is_over.rs new file mode 100644 index 00000000..f8016805 --- /dev/null +++ b/libimagentryfilter/src/builtin/content/length/is_over.rs @@ -0,0 +1,28 @@ +use libimagstore::store::Entry; + +use builtin::header::field_path::FieldPath; +use filter::Filter; + +pub struct ContentLengthIsOver { + val: usize +} + +impl ContentLengthIsOver { + + pub fn new(value: usize) -> ContentLengthIsOver { + ContentLengthIsOver { + val: value, + } + } + +} + +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 new file mode 100644 index 00000000..07ade8dc --- /dev/null +++ b/libimagentryfilter/src/builtin/content/length/is_under.rs @@ -0,0 +1,28 @@ +use libimagstore::store::Entry; + +use builtin::header::field_path::FieldPath; +use filter::Filter; + +pub struct ContentLengthIsUnder { + val: usize +} + +impl ContentLengthIsUnder { + + pub fn new(value: usize) -> ContentLengthIsUnder { + ContentLengthIsUnder { + val: value, + } + } + +} + +impl Filter for ContentLengthIsUnder { + + fn filter(&self, e: &Entry) -> bool { + e.get_content().len() < self.val + } + +} + + diff --git a/libimagentryfilter/src/builtin/content/length/mod.rs b/libimagentryfilter/src/builtin/content/length/mod.rs new file mode 100644 index 00000000..94121f96 --- /dev/null +++ b/libimagentryfilter/src/builtin/content/length/mod.rs @@ -0,0 +1,2 @@ +pub mod is_over; +pub mod is_under; diff --git a/libimagentryfilter/src/builtin/content/mod.rs b/libimagentryfilter/src/builtin/content/mod.rs index 21e9e600..b0ec6127 100644 --- a/libimagentryfilter/src/builtin/content/mod.rs +++ b/libimagentryfilter/src/builtin/content/mod.rs @@ -1 +1,2 @@ pub mod grep; +pub mod length;