add raw method to instruction.rs

This commit is contained in:
Denis-Cosmin NUTIU 2024-12-01 23:11:06 +02:00
parent 3944ae36a8
commit 6721857320

View file

@ -13,10 +13,15 @@ impl Instruction {
data: (data[0] as u16) << 8u8 | (data[1] as u16),
}
}
/// raw returns the raw instruction data.
pub fn raw(&self) -> u16 {
self.data
}
}
impl Display for Instruction {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
f.write_str(&format!(
"Instruction: [{:02x}, {:02x}]",
((self.data & 0xFF00) >> 8u8) as u8,