use super::Neu;
use crate::MayDebug;
#[derive(Debug, Clone, Default, Copy)]
pub struct Equal<T> {
val: T,
}
impl<T: PartialEq + MayDebug> core::ops::Not for Equal<T> {
type Output = crate::neu::Not<Self, T>;
fn not(self) -> Self::Output {
crate::neu::not(self)
}
}
impl<T> Equal<T> {
pub const fn new(val: T) -> Self {
Self { val }
}
}
impl<T: PartialEq + MayDebug> Neu<T> for Equal<T> {
#[inline(always)]
fn is_match(&self, other: &T) -> bool {
let val = &self.val;
let ret = val == other;
crate::trace_retval!("Equal", val, other, ret)
}
}
pub const fn equal<T: PartialEq + MayDebug>(val: T) -> Equal<T> {
Equal { val }
}