#![allow(unused_imports)]
use super::*;
pub trait FnBiPredicateOps<T, U>: Fn(&T, &U) -> bool + Sized {
fn and<P>(self, other: P) -> BoxBiPredicate<T, U>
where
Self: 'static,
P: BiPredicate<T, U> + 'static,
T: 'static,
U: 'static,
{
BoxBiPredicate::new(move |first, second| self(first, second) && other.test(first, second))
}
fn or<P>(self, other: P) -> BoxBiPredicate<T, U>
where
Self: 'static,
P: BiPredicate<T, U> + 'static,
T: 'static,
U: 'static,
{
BoxBiPredicate::new(move |first, second| self(first, second) || other.test(first, second))
}
fn not(self) -> BoxBiPredicate<T, U>
where
Self: 'static,
T: 'static,
U: 'static,
{
BoxBiPredicate::new(move |first, second| !self(first, second))
}
fn nand<P>(self, other: P) -> BoxBiPredicate<T, U>
where
Self: 'static,
P: BiPredicate<T, U> + 'static,
T: 'static,
U: 'static,
{
BoxBiPredicate::new(move |first, second| {
!(self(first, second) && other.test(first, second))
})
}
fn xor<P>(self, other: P) -> BoxBiPredicate<T, U>
where
Self: 'static,
P: BiPredicate<T, U> + 'static,
T: 'static,
U: 'static,
{
BoxBiPredicate::new(move |first, second| self(first, second) ^ other.test(first, second))
}
fn nor<P>(self, other: P) -> BoxBiPredicate<T, U>
where
Self: 'static,
P: BiPredicate<T, U> + 'static,
T: 'static,
U: 'static,
{
BoxBiPredicate::new(move |first, second| {
!(self(first, second) || other.test(first, second))
})
}
}
impl<T, U, F> FnBiPredicateOps<T, U> for F where F: Fn(&T, &U) -> bool {}