Macro mm0_util::let_unchecked [−][src]
macro_rules! let_unchecked {
($q : ident as $p : pat = $e : expr) => { ... };
(($($q : tt), *) as $p : pat = $e : expr) => { ... };
($p : pat = $e : expr, $bl : expr) => { ... };
}
Expand description
let_unchecked!(x as p = e)
is the same asⓘwherelet x = if let p = e {x} else {unreachable_unchecked()};
p
is a pattern containing the variable(s)x
(which may be a tuple)let_unchecked!(p = e, { block })
is the same asⓘso the variablesif let p = e { block } else {unreachable_unchecked()}
x
don’t have to be declared but the variables inp
are scoped to theblock
.
Safety
This invokes undefined behavior when the pattern does not match.