summaryrefslogtreecommitdiff
path: root/src/macros.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2019-11-17 20:57:50 +0100
committerLaurenz <laurmaedje@gmail.com>2019-11-17 20:57:50 +0100
commit14259c7d09c12327b18aba21cc577e68ad283eda (patch)
tree0f9a7a138141e84cfcb8691f41e29f7493879eab /src/macros.rs
parentf6cb4d725ee6e4fd09b92b5af7348d11ac951b10 (diff)
Fix alignment bugs ✔
Diffstat (limited to 'src/macros.rs')
-rw-r--r--src/macros.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/macros.rs b/src/macros.rs
index e7113672..b6f069b7 100644
--- a/src/macros.rs
+++ b/src/macros.rs
@@ -40,6 +40,16 @@ macro_rules! error_type {
};
}
+/// Shorthand for checking whether an expression matches a pattern.
+macro_rules! matches {
+ ($expr:expr, $($pattern:tt)*) => {
+ match $expr {
+ $($pattern)* => true,
+ _ => false,
+ }
+ };
+}
+
/// Create a `Debug` implementation from a `Display` implementation.
macro_rules! debug_display {
($type:ident) => (
@@ -58,6 +68,7 @@ macro_rules! debug_display {
);
}
+/// Declare a module and reexport all its contents.
macro_rules! pub_use_mod {
($name:ident) => {
mod $name;