pub enum Instr {
ZeroOp(Opcode),
OneOp(Opcode, DataIdx),
TwoOp(Opcode, DataIdx, DataIdx),
}Expand description
An instruction in a KO file
Variants§
ZeroOp(Opcode)
An instruction that takes no operands
OneOp(Opcode, DataIdx)
An instruction that takes one operand
TwoOp(Opcode, DataIdx, DataIdx)
An instruction that takes two operands
Implementations§
Source§impl Instr
impl Instr
Sourcepub fn size_bytes(&self) -> u32
pub fn size_bytes(&self) -> u32
Returns the size in bytes that this instruction would take up in a KO file
Sourcepub fn write(&self, buf: &mut impl WritableBuffer)
pub fn write(&self, buf: &mut impl WritableBuffer)
Converts this instruction to its binary representation and appends it to the provided buffer
Sourcepub fn parse(source: &mut BufferIterator<'_>) -> Result<Self, InstrParseError>
pub fn parse(source: &mut BufferIterator<'_>) -> Result<Self, InstrParseError>
Parses a KO file instruction from the provided buffer
Trait Implementations§
impl Copy for Instr
impl Eq for Instr
impl StructuralPartialEq for Instr
Auto Trait Implementations§
impl Freeze for Instr
impl RefUnwindSafe for Instr
impl Send for Instr
impl Sync for Instr
impl Unpin for Instr
impl UnwindSafe for Instr
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more