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

33 lines
722 B
Rust

use crate::{Instruction, Operation};
use super::InstructionData;
pub struct LoadSelf {
pub destination: u8,
}
impl From<&Instruction> for LoadSelf {
fn from(instruction: &Instruction) -> Self {
let destination = instruction.a_field();
LoadSelf { destination }
}
}
impl From<InstructionData> for LoadSelf {
fn from(instruction: InstructionData) -> Self {
let destination = instruction.a_field;
LoadSelf { destination }
}
}
impl From<LoadSelf> for Instruction {
fn from(load_self: LoadSelf) -> Self {
let operation = Operation::LOAD_SELF;
let a = load_self.destination;
Instruction::new(operation, a, 0, 0, false, false, false)
}
}