use super::{
StatefulTester,
box_stateful_tester::BoxStatefulTester,
};
pub trait FnStatefulTesterOps: Sized + FnMut() -> bool {
#[inline]
fn and<T>(mut self, mut other: T) -> BoxStatefulTester
where
Self: 'static,
T: StatefulTester + 'static,
{
BoxStatefulTester::new(move || self() && other.test())
}
#[inline]
fn or<T>(mut self, mut other: T) -> BoxStatefulTester
where
Self: 'static,
T: StatefulTester + 'static,
{
BoxStatefulTester::new(move || self() || other.test())
}
#[inline]
fn not(mut self) -> BoxStatefulTester
where
Self: 'static,
{
BoxStatefulTester::new(move || !self())
}
#[inline]
fn nand<T>(mut self, mut other: T) -> BoxStatefulTester
where
Self: 'static,
T: StatefulTester + 'static,
{
BoxStatefulTester::new(move || !(self() && other.test()))
}
#[inline]
fn xor<T>(mut self, mut other: T) -> BoxStatefulTester
where
Self: 'static,
T: StatefulTester + 'static,
{
BoxStatefulTester::new(move || self() ^ other.test())
}
#[inline]
fn nor<T>(mut self, mut other: T) -> BoxStatefulTester
where
Self: 'static,
T: StatefulTester + 'static,
{
BoxStatefulTester::new(move || !(self() || other.test()))
}
}
impl<F> FnStatefulTesterOps for F where F: FnMut() -> bool {}