| 1 | #[doc (hidden)]
|
| 2 | #[macro_export (local_inner_macros)]
|
| 3 | macro_rules! _overload_unary {
|
| 4 | (-, $($t:tt)+) => (_overload_unary_internal!(Neg, neg, $($t)+););
|
| 5 | (!, $($t:tt)+) => (_overload_unary_internal!(Not, not, $($t)+););
|
| 6 | }
|
| 7 |
|
| 8 | #[doc (hidden)]
|
| 9 | #[macro_export (local_inner_macros)]
|
| 10 | macro_rules! _overload_unary_internal {
|
| 11 | ($op_trait:ident, $op_fn:ident, $i:ident, $t:ty, $out:ty, $body:block) => (
|
| 12 | impl ops::$op_trait for $t {
|
| 13 | type Output = $out;
|
| 14 | fn $op_fn(self) -> Self::Output {
|
| 15 | let $i = self;
|
| 16 | $body
|
| 17 | }
|
| 18 | }
|
| 19 | );
|
| 20 | }
|
| 21 | |