pub struct Instruction {
pub opcode: Opcode,
pub address: Gs2BytecodeAddress,
pub operand: Option<Operand>,
}
Expand description
Represents an instruction in a bytecode system.
Fields§
§opcode: Opcode
The opcode of the instruction.
address: Gs2BytecodeAddress
The address of the instruction.
operand: Option<Operand>
The operand of the instruction, if any.
Implementations§
Source§impl Instruction
impl Instruction
Trait Implementations§
Source§impl Clone for Instruction
impl Clone for Instruction
Source§fn clone(&self) -> Instruction
fn clone(&self) -> Instruction
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for Instruction
impl Debug for Instruction
Source§impl<'de> Deserialize<'de> for Instruction
impl<'de> Deserialize<'de> for Instruction
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for Instruction
Implement the Display
trait for Instruction
.
impl Display for Instruction
Implement the Display
trait for Instruction
.
Source§fn fmt(&self, f: &mut Formatter<'_>) -> Result
fn fmt(&self, f: &mut Formatter<'_>) -> Result
Convert the Instruction to a string
§Returns
- A string representation of the instruction.
§Example
use gbf_core::instruction::Instruction;
use gbf_core::operand::Operand;
use gbf_core::opcode::Opcode;
let instruction = Instruction::new_with_operand(Opcode::PushNumber, 0, Operand::new_number(42));
let string = instruction.to_string();
assert_eq!(string, "PushNumber 0x2a");
Source§impl Hash for Instruction
impl Hash for Instruction
Source§impl PartialEq for Instruction
impl PartialEq for Instruction
Source§impl Serialize for Instruction
impl Serialize for Instruction
impl Eq for Instruction
impl StructuralPartialEq for Instruction
Auto Trait Implementations§
impl Freeze for Instruction
impl RefUnwindSafe for Instruction
impl Send for Instruction
impl Sync for Instruction
impl Unpin for Instruction
impl UnwindSafe for Instruction
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.