Macro try_let_instr
try_let_instr!() { /* proc-macro */ }
Expand description
let / else
style pattern matching and destructuring of instructions and their expressions.
try_let_instr!
allows you to match a LowLevelILInstruction
against a single pattern,
binding variables if the match succeeds and executing the else
branch if the match fails.
It’s analogous to let-else
syntax in Rust, but allows matching through expressions in a
single step. This is useful for writing concise and readable instruction-matching code.
§Example
try_let_instr!{
let SetRegSsa(dest, Lsr(RegSsa(source), Const(5))) = instr else { return None }
}
This expands to a match on instr
, binding dest
and source
if the pattern matches,
or returning None
if it does not.