1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
use super::Instruction; use super::InstructionTrait; #[derive(Debug, PartialEq)] pub struct Nop {} impl Nop { pub fn new() -> Nop { Nop {} } pub fn new_instruction() -> Instruction { Instruction::Nop(Self::new()) } } impl From<Nop> for Instruction { fn from(item: Nop) -> Self { Self::Nop(item) } } impl std::fmt::Display for Nop { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { write!(f, "NOP") } } impl InstructionTrait for Nop { fn size(&self) -> usize { 1 } }