summaryrefslogtreecommitdiffstats
path: root/src/ops/not.rs
blob: 895b7decd40cd29c2713bd7959a6f269088a16b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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)
    }

}