From 67218573208414582c90f051e89d56ab51665738 Mon Sep 17 00:00:00 2001 From: Denis-Cosmin NUTIU Date: Sun, 1 Dec 2024 23:11:06 +0200 Subject: [PATCH] add raw method to instruction.rs --- src/instruction.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/instruction.rs b/src/instruction.rs index b2fd0ad..c0e9bad 100644 --- a/src/instruction.rs +++ b/src/instruction.rs @@ -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,