diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2016-08-12 12:36:47 +0200 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2016-08-12 12:36:47 +0200 |
commit | 8edf4d5f19b000b9c1a134dd2ca8b328af5915c9 (patch) | |
tree | e899e341905414e0d0c37c5eb25979e40d04aadb /src/filter.rs | |
parent | f6bc7bef1e4f497b6195d80cb60bcca6208781a0 (diff) |
Add Filter::nand()
Diffstat (limited to 'src/filter.rs')
-rw-r--r-- | src/filter.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/filter.rs b/src/filter.rs index b789c4f..f8a6af9 100644 --- a/src/filter.rs +++ b/src/filter.rs @@ -139,6 +139,19 @@ pub trait Filter<N> { self.and(Not::new(other.into_filter())) } + /// Helper to connect two filters via logical NAND + /// + /// ```ignore + /// let a = (|&a: &usize| { a == 1 }); + /// let b = (|&a: &usize| { a == 2 }); + /// + /// a.nand(b) == (|&a: &usize| { !(a == 1 && a == 2) }) + /// ``` + fn nand<F>(self, other: F) -> Not<And<Self, F>> + where Self: Sized, + { + Not::new(And::new(self, other)) + } } |