aboutsummaryrefslogtreecommitdiff
path: root/src/internal
diff options
context:
space:
mode:
authorMei Boudreau <[email protected]>2017-10-12 18:18:31 -0400
committerZeyla Hellyer <[email protected]>2017-10-12 15:18:31 -0700
commit9b0c053725e04c60eb7ddcfeb847be4189b3dbf6 (patch)
tree6e1c2f5a38188f389bc14df7691a39549c9c2128 /src/internal
parentOptimize Member::roles (diff)
downloadserenity-9b0c053725e04c60eb7ddcfeb847be4189b3dbf6.tar.xz
serenity-9b0c053725e04c60eb7ddcfeb847be4189b3dbf6.zip
Add try_opt macro for substitute
Diffstat (limited to 'src/internal')
-rw-r--r--src/internal/macros.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/internal/macros.rs b/src/internal/macros.rs
index 4ee43d3..92a21c1 100644
--- a/src/internal/macros.rs
+++ b/src/internal/macros.rs
@@ -181,3 +181,10 @@ macro_rules! enum_number {
}
}
}
+
+macro_rules! try_opt {
+ ($x:expr) => (match $x {
+ Some(v) => v,
+ None => return None,
+ });
+}