diff --git a/rust/src/debug.rs b/rust/src/debug.rs index caeecff93a..16b128390f 100644 --- a/rust/src/debug.rs +++ b/rust/src/debug.rs @@ -236,3 +236,13 @@ macro_rules! debug_validate_fail ( } }; ); + +#[macro_export] +macro_rules! unwrap_or_return ( + ($e:expr, $r:expr) => { + match $e { + Ok(x) => x, + Err(_) => return $r, + } + }; +);