blob: bddb7edc74c0d58d54c061c5f39e6c6547b13194 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
//! NOT implementation.
//!
//! Will be automatically included when incluing `filter::Filter`, so importing this module
//! shouldn't be necessary.
//!
use filter::Filter;
#[must_use = "filters are lazy and do nothing unless consumed"]
#[derive(Clone)]
pub struct Not<T> {
a: T
}
impl<T> Not<T> {
pub fn new(a: T) -> Not<T> {
Not { a: a }
}
}
impl<I, T: Filter<I>> Filter<I> for Not<T> {
fn filter(&self, e: &I) -> bool {
!self.a.filter(e)
}
}
|