2016-02-02 13:48:05 +00:00
|
|
|
use libimagstore::store::Entry;
|
|
|
|
|
|
|
|
pub use ops::and::And;
|
|
|
|
pub use ops::not::Not;
|
|
|
|
pub use ops::or::Or;
|
|
|
|
|
|
|
|
pub trait Filter {
|
|
|
|
|
|
|
|
fn filter(&self, &Entry) -> bool;
|
|
|
|
|
|
|
|
fn not(self) -> Not
|
|
|
|
where Self: Sized + 'static
|
|
|
|
{
|
|
|
|
Not::new(Box::new(self))
|
|
|
|
}
|
|
|
|
|
|
|
|
fn or(self, other: Box<Filter>) -> Or
|
|
|
|
where Self: Sized + 'static
|
|
|
|
{
|
|
|
|
Or::new(Box::new(self), other)
|
|
|
|
}
|
|
|
|
|
2016-02-02 16:57:27 +00:00
|
|
|
fn or_not(self, other: Box<Filter>) -> Or
|
|
|
|
where Self: Sized + 'static
|
|
|
|
{
|
|
|
|
self.or(Box::new(Not::new(other)))
|
|
|
|
}
|
|
|
|
|
2016-02-02 16:54:02 +00:00
|
|
|
fn or3(self, other: Box<Filter>, other2: Box<Filter>) -> Or
|
|
|
|
where Self: Sized + 'static
|
|
|
|
{
|
|
|
|
Or::new(Box::new(self), Box::new(Or::new(other, other2)))
|
|
|
|
}
|
|
|
|
|
2016-02-02 13:48:05 +00:00
|
|
|
fn and(self, other: Box<Filter>) -> And
|
|
|
|
where Self: Sized + 'static
|
|
|
|
{
|
|
|
|
And::new(Box::new(self), other)
|
|
|
|
}
|
|
|
|
|
2016-02-02 16:54:02 +00:00
|
|
|
fn and3(self, other: Box<Filter>, other2: Box<Filter>) -> And
|
|
|
|
where Self: Sized + 'static
|
|
|
|
{
|
|
|
|
And::new(Box::new(self), Box::new(And::new(other, other2)))
|
|
|
|
}
|
|
|
|
|
2016-02-02 16:57:27 +00:00
|
|
|
fn and_not(self, other: Box<Filter>) -> And
|
|
|
|
where Self: Sized + 'static
|
|
|
|
{
|
|
|
|
self.and(Box::new(Not::new(other)))
|
|
|
|
}
|
|
|
|
|
2016-02-02 13:48:05 +00:00
|
|
|
}
|
|
|
|
|