#[macro_export]
macro_rules! unary_operation {
(
impl $op_trait:ident for ...($( $T:ty ),*) {
$doc:literal
fn $op_method:ident ($base:ident : $base_ty:ty) -> Self::Output
$implementation:block
}
) => {
$(
impl $op_trait for $T {
type Output = $T;
#[doc = $doc]
#[inline(always)]
fn $op_method(self) -> Self::Output {
let $base: $base_ty = self.0;
$implementation
}
}
impl $op_trait for &$T {
type Output = $T;
#[doc = $doc]
#[inline(always)]
fn $op_method(self) -> Self::Output {
(*self).$op_method()
}
}
)*
};
}