Add builtin header check: Field exists

This commit is contained in:
Matthias Beyer 2016-02-03 16:23:39 +01:00
parent 12443f631b
commit 780410f29d
2 changed files with 33 additions and 1 deletions

View file

@ -0,0 +1,31 @@
use libimagstore::store::Entry;
use builtin::header::field_path::FieldPath;
use filter::Filter;
use toml::Value;
pub struct FieldExists {
header_field_path: FieldPath,
}
impl FieldExists {
pub fn new(path: FieldPath) -> FieldExists {
FieldExists {
header_field_path: path,
}
}
}
impl Filter for FieldExists {
fn filter(&self, e: &Entry) -> bool {
let header = e.get_header();
self.header_field_path.walk(header).is_some()
}
}

View file

@ -1,5 +1,6 @@
pub mod field_eq; pub mod field_eq;
pub mod field_exists;
pub mod field_grep; pub mod field_grep;
pub mod field_isempty;
pub mod field_istype; pub mod field_istype;
pub mod field_path; pub mod field_path;