chiark
/
gitweb
/
~ianmdlvl
/
otter.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
ac454b8
)
if_let: Provide a way to get at the error
author
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Sun, 16 May 2021 22:24:52 +0000
(23:24 +0100)
committer
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Mon, 17 May 2021 13:58:58 +0000
(14:58 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
base/misc.rs
patch
|
blob
|
history
diff --git
a/base/misc.rs
b/base/misc.rs
index faa47bc4018bedb8a34ad7a47f15700ec3e90639..66c98ffff129c7fe94dee4be9aed7f41fc35b8b4 100644
(file)
--- a/
base/misc.rs
+++ b/
base/misc.rs
@@
-67,6
+67,14
@@
pub fn space_rect_attrs(table_size: PosC<f64>) -> SvgAttrs {
#[macro_export]
macro_rules! if_let {
+ { $($variant:ident)::+ ($binding:pat) = $input:expr;
+ match $($otherwise:tt)*
+ } => {
+ let $binding = match $input {
+ $($variant)::+ (y) => y,
+ $($otherwise)*,
+ };
+ };
{ $($variant:ident)::+ ($binding:pat) = $input:expr;
else $($otherwise:tt)*
} => {