parser/instructions/
nop.rs

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