diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:19:43 +0000 |
commit | 3e3e70d529d8c7d7c4d7bc4fefc9f109393b9245 (patch) | |
tree | daf049b282ab10e8c3d03e409b3cd84ff3f7690c /vendor/overload/src/binary.rs | |
parent | Adding debian version 1.68.2+dfsg1-1. (diff) | |
download | rustc-3e3e70d529d8c7d7c4d7bc4fefc9f109393b9245.tar.xz rustc-3e3e70d529d8c7d7c4d7bc4fefc9f109393b9245.zip |
Merging upstream version 1.69.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/overload/src/binary.rs')
-rw-r--r-- | vendor/overload/src/binary.rs | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/vendor/overload/src/binary.rs b/vendor/overload/src/binary.rs new file mode 100644 index 000000000..b4c781bff --- /dev/null +++ b/vendor/overload/src/binary.rs @@ -0,0 +1,28 @@ +#[doc(hidden)]
+#[macro_export(local_inner_macros)]
+macro_rules! _overload_binary {
+ (+, $($t:tt)+) => (_overload_binary_internal!(Add, add, $($t)+););
+ (-, $($t:tt)+) => (_overload_binary_internal!(Sub, sub, $($t)+););
+ (*, $($t:tt)+) => (_overload_binary_internal!(Mul, mul, $($t)+););
+ (/, $($t:tt)+) => (_overload_binary_internal!(Div, div, $($t)+););
+ (%, $($t:tt)+) => (_overload_binary_internal!(Rem, rem, $($t)+););
+ (&, $($t:tt)+) => (_overload_binary_internal!(BitAnd, bitand, $($t)+););
+ (|, $($t:tt)+) => (_overload_binary_internal!(BitOr, bitor, $($t)+););
+ (^, $($t:tt)+) => (_overload_binary_internal!(BitXor, bitxor, $($t)+););
+ (<<, $($t:tt)+) => (_overload_binary_internal!(Shl, shl, $($t)+););
+ (>>, $($t:tt)+) => (_overload_binary_internal!(Shr, shr, $($t)+););
+}
+
+#[doc(hidden)]
+#[macro_export(local_inner_macros)]
+macro_rules! _overload_binary_internal {
+ ($op_trait:ident, $op_fn:ident, $li:ident, $lt:ty, $ri:ident, $rt:ty, $out:ty, $body:block) => (
+ impl ops::$op_trait<$rt> for $lt {
+ type Output = $out;
+ fn $op_fn(self, $ri: $rt) -> Self::Output {
+ let $li = self;
+ $body
+ }
+ }
+ );
+}
|