1 | #[doc (hidden)]
|
2 | #[macro_export (local_inner_macros)]
|
3 | macro_rules! _overload_assignment {
|
4 | (+=, $($t:tt)+) => (_overload_assignment_internal!(AddAssign, add_assign, $($t)+););
|
5 | (-=, $($t:tt)+) => (_overload_assignment_internal!(SubAssign, sub_assign, $($t)+););
|
6 | (*=, $($t:tt)+) => (_overload_assignment_internal!(MulAssign, mul_assign, $($t)+););
|
7 | (/=, $($t:tt)+) => (_overload_assignment_internal!(DivAssign, div_assign, $($t)+););
|
8 | (%=, $($t:tt)+) => (_overload_assignment_internal!(RemAssign, rem_assign, $($t)+););
|
9 | (&=, $($t:tt)+) => (_overload_assignment_internal!(BitAndAssign, bitand_assign, $($t)+););
|
10 | (|=, $($t:tt)+) => (_overload_assignment_internal!(BitOrAssign, bitor_assign, $($t)+););
|
11 | (^=, $($t:tt)+) => (_overload_assignment_internal!(BitXorAssign, bitxor_assign, $($t)+););
|
12 | (<<=, $($t:tt)+) => (_overload_assignment_internal!(ShlAssign, shl_assign, $($t)+););
|
13 | (>>=, $($t:tt)+) => (_overload_assignment_internal!(ShrAssign, shr_assign, $($t)+););
|
14 | }
|
15 |
|
16 | #[doc (hidden)]
|
17 | #[macro_export (local_inner_macros)]
|
18 | macro_rules! _overload_assignment_internal {
|
19 | ($op_trait:ident, $op_fn:ident, $li:ident, $lt:ty, $ri:ident, $rt:ty, $body:block) => (
|
20 | impl ops::$op_trait<$rt> for $lt {
|
21 | fn $op_fn(&mut self, $ri: $rt) {
|
22 | let $li = self;
|
23 | $body
|
24 | }
|
25 | }
|
26 | );
|
27 | }
|
28 | |