about summary refs log tree commit diff
path: root/src/util/trait_impls.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/trait_impls.rs')
-rw-r--r--src/util/trait_impls.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/util/trait_impls.rs b/src/util/trait_impls.rs
new file mode 100644
index 000000000000..ba15f7119d26
--- /dev/null
+++ b/src/util/trait_impls.rs
@@ -0,0 +1,17 @@
+macro_rules! ref_impl {
+    (impl<T: $traitb: ident $(+ $bound:ident)*> $traiti:ident for &T {
+        $($body:tt)*
+    }) => {
+        impl<'a, T: $traitb $(+ $bound)*> $traiti for &'a T {
+            $($body)*
+        }
+
+        impl<'a, T: $traitb $(+ $bound)*> $traiti for &'a mut T {
+            $($body)*
+        }
+
+        impl<T: $traitb $(+ $bound)*> $traiti for ::std::boxed::Box<T> {
+            $($body)*
+        }
+    };
+}