pub trait Equal<Rhs: ?Sized = Self> {
type Output;
fn is_equal(&self, other: &Rhs) -> Self::Output;
fn is_not_equal(&self, other: &Rhs) -> Self::Output;
}
pub trait Compare<Rhs: ?Sized = Self> {
type Output;
fn is_less_than(&self, other: &Rhs) -> Self::Output;
fn is_greater_than(&self, other: &Rhs) -> Self::Output;
fn is_less_than_or_equal(&self, other: &Rhs) -> Self::Output;
fn is_greater_than_or_equal(&self, other: &Rhs) -> Self::Output;
}
pub trait Nand<Rhs: ?Sized = Self> {
type Output;
fn nand(&self, other: &Rhs) -> Self::Output;
}
pub trait Nor<Rhs: ?Sized = Self> {
type Output;
fn nor(&self, other: &Rhs) -> Self::Output;
}
pub trait Ternary {
type Boolean;
type Output;
fn ternary(condition: &Self::Boolean, first: &Self, second: &Self) -> Self::Output
where
Self: Sized;
}
impl<T: Ternary> Ternary for Box<T> {
type Boolean = T::Boolean;
type Output = Box<T::Output>;
fn ternary(condition: &Self::Boolean, first: &Self, second: &Self) -> Self::Output {
Box::new(T::ternary(condition, first, second))
}
}