Implement {and,or}_not() variants

This commit is contained in:
Matthias Beyer 2016-02-02 17:57:27 +01:00
parent d4cee5459f
commit 34e62aaade

View file

@ -20,6 +20,12 @@ pub trait Filter {
Or::new(Box::new(self), other) 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 fn or3(self, other: Box<Filter>, other2: Box<Filter>) -> Or
where Self: Sized + 'static where Self: Sized + 'static
{ {
@ -38,5 +44,11 @@ pub trait Filter {
And::new(Box::new(self), Box::new(And::new(other, other2))) 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)))
}
} }