diff options
| author | Laurenz <laurmaedje@gmail.com> | 2019-11-15 13:05:25 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2019-11-15 13:05:25 +0100 |
| commit | 9473ae61e9cfc419eb6b48fb0ed15441cc7ad48b (patch) | |
| tree | da7f23a8a653b41b5395a4756f1ee0472f5b35e0 /src/macros.rs | |
| parent | 40c879e3c03794a52cabcf31dc4216afc53c6ec5 (diff) | |
Generalize stack layouter 🎲
Diffstat (limited to 'src/macros.rs')
| -rw-r--r-- | src/macros.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/macros.rs b/src/macros.rs index 70c67105..a162d3cc 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -40,6 +40,16 @@ macro_rules! error_type { }; } +/// Whether an expression matches a pattern. +macro_rules! matches { + ($val:expr, $($pattern:tt)*) => ( + match $val { + $($pattern)* => true, + _ => false, + } + ); +} + /// Create a `Debug` implementation from a `Display` implementation. macro_rules! debug_display { ($type:ident) => ( |
