From 34e62aaade1a34ca273e8190c6f5fbaff8591346 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Tue, 2 Feb 2016 17:57:27 +0100 Subject: [PATCH] Implement {and,or}_not() variants --- libimagentryfilter/src/filter.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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) -> Or + where Self: Sized + 'static + { + self.or(Box::new(Not::new(other))) + } + fn or3(self, other: Box, other2: Box) -> 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) -> And + where Self: Sized + 'static + { + self.and(Box::new(Not::new(other))) + } + }