1
0
dust/dust-lang/src/instruction/load_self.rs

33 lines
722 B
Rust
Raw Normal View History

use crate::{Instruction, Operation};
2024-11-26 07:14:30 -05:00
2024-12-17 07:10:47 -05:00
use super::InstructionData;
2024-11-26 07:14:30 -05:00
pub struct LoadSelf {
pub destination: u8,
2024-11-26 07:14:30 -05:00
}
impl From<&Instruction> for LoadSelf {
fn from(instruction: &Instruction) -> Self {
let destination = instruction.a_field();
LoadSelf { destination }
2024-11-26 07:14:30 -05:00
}
}
2024-12-17 07:10:47 -05:00
impl From<InstructionData> for LoadSelf {
fn from(instruction: InstructionData) -> Self {
let destination = instruction.a_field;
LoadSelf { destination }
}
}
2024-11-26 07:14:30 -05:00
impl From<LoadSelf> for Instruction {
fn from(load_self: LoadSelf) -> Self {
2024-12-11 09:26:38 -05:00
let operation = Operation::LOAD_SELF;
let a = load_self.destination;
Instruction::new(operation, a, 0, 0, false, false, false)
2024-11-26 07:14:30 -05:00
}
}