Trait NumberedRegister
pub trait NumberedRegister {
// Required methods
fn as_num(&self) -> usize;
fn from_num(num: usize) -> Self;
}
Expand description
Implements conversion to and from usize
.
This is required for general purpose registers, and is used as an optimization in some code.
Required Methods§
fn as_num(&self) -> usize
fn as_num(&self) -> usize
Converts the register to a usize
.
Inverse of NumberedRegister::from_num
.
fn from_num(num: usize) -> Self
fn from_num(num: usize) -> Self
Converts the usize
to a register.
Inverse of NumberedRegister::as_num
.
§Panics
This function will panic if the usize
does not refer to a valid register.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.