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
    let x = if let p = e {x} else {unreachable_unchecked()};
    where p is a pattern containing the variable(s) x (which may be a tuple)
  • let_unchecked!(p = e, { block }) is the same as
    if let p = e { block } else {unreachable_unchecked()}
    so the variables x don’t have to be declared but the variables in p are scoped to the block.

Safety

This invokes undefined behavior when the pattern does not match.