diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2016-02-02 17:57:27 +0100 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2016-02-03 16:39:05 +0100 |
commit | 34e62aaade1a34ca273e8190c6f5fbaff8591346 (patch) | |
tree | e4e6eef23b7da07f87cdef501b0f6b46d44c7871 /libimagentryfilter | |
parent | d4cee5459fec9bf5f90bb2f140134fbf91feec79 (diff) |
Implement {and,or}_not() variants
Diffstat (limited to 'libimagentryfilter')
-rw-r--r-- | libimagentryfilter/src/filter.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/libimagentryfilter/src/filter.rs b/libimagentryfilter/src/filter.rs index dd8128e4..2d0015a1 100644 --- a/libimagentryfilter/src/filter.rs +++ b/libimagentryfilter/src/filter.rs @@ -20,6 +20,12 @@ pub trait Filter { Or::new(Box::new(self), other) } + fn or_not(self, other: Box<Filter>) -> Or + where Self: Sized + 'static + { + self.or(Box::new(Not::new(other))) + } + fn or3(self, other: Box<Filter>, other2: Box<Filter>) -> Or where Self: Sized + 'static { @@ -38,5 +44,11 @@ pub trait Filter { And::new(Box::new(self), Box::new(And::new(other, other2))) } + fn and_not(self, other: Box<Filter>) -> And + where Self: Sized + 'static + { + self.and(Box::new(Not::new(other))) + } + } |