macro_rules! commutative_op_impl {
($tt:ident, $fn:ident, $t_lhs:ty, $t_rhs:ty, $t_out:ty) => {
impl<T: $crate::numeric::Domain> $tt<$t_rhs> for $t_lhs {
type Output = $t_out;
fn $fn(&self, rhs: &$t_rhs) -> Self::Output {
rhs.$fn(self)
}
}
};
}
pub(crate) use commutative_op_impl;
macro_rules! commutative_predicate_impl {
($tt:ident, $fn:ident, $t_lhs:ty, $t_rhs:ty) => {
impl<T: $crate::numeric::Domain> $tt<$t_rhs> for $t_lhs {
fn $fn(&self, rhs: &$t_rhs) -> bool {
rhs.$fn(self)
}
}
};
}
pub(crate) use commutative_predicate_impl;