aboutsummaryrefslogtreecommitdiff
path: root/src/util.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/util.rs')
-rw-r--r--src/util.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/util.rs b/src/util.rs
new file mode 100644
index 0000000..78d2cd4
--- /dev/null
+++ b/src/util.rs
@@ -0,0 +1,13 @@
+macro_rules! trait_alias {
+ (
+ $(#[$attr: meta])*
+ $visibility: vis $name: ident$(<$($type_param: ident),*>)?$(: $first_bound: tt $(+ $bound: tt)*)?;
+ ) => {
+ $(#[$attr])*
+ $visibility trait $name $(<$($type_param),*>)? $(: $first_bound $(+ $bound)*)? {}
+
+ impl<T: $($first_bound $(+ $bound)*)?, $($($type_param),*)?> $name$(<$($type_param),*>)? for T {}
+ };
+}
+
+pub(crate) use trait_alias;