#[doc(hidden)]
#[macro_export]
macro_rules! _parse_unary_op {
(-, $($t:tt)+) => ($crate::_impl_unary_op_internal!(ops, Neg, neg, $($t)+););
(!, $($t:tt)+) => ($crate::_impl_unary_op_internal!(ops, Not, not, $($t)+););
}
#[doc(hidden)]
#[macro_export]
macro_rules! _impl_unary_op_internal {
($path:ident, $ops_trait:ident, $ops_fn:ident, &$lhs:ty, $out:ty, $lhs_i:ident, $body:block) => {
impl $path::$ops_trait for &$lhs {
type Output = $out;
#[inline]
fn $ops_fn(self) -> Self::Output {
let $lhs_i = self;
$body
}
}
};
($path:ident, $ops_trait:ident, $ops_fn:ident, $lhs:ty, $out:ty, $lhs_i:ident, $body:block) => {
impl $path::$ops_trait for $lhs {
type Output = $out;
#[inline]
fn $ops_fn(self) -> Self::Output {
let $lhs_i = self;
$body
}
}
};
}