forc_debug::names

Function register_index

Source
pub fn register_index(name: &str) -> Option<usize>
Expand description

Returns the index of a register given its name.

If the name matches a predefined register in REGISTERS, the corresponding index is returned. Otherwise, returns None.

ยงExamples

use forc_debug::names::register_index;
assert_eq!(register_index("zero"), Some(0));
assert_eq!(register_index("flag"), Some(15));
assert_eq!(register_index("unknown"), None);