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

25 lines
519 B
Rust
Raw Normal View History

use crate::{Instruction, Operation};
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;
LoadSelf { destination }
2024-11-26 07:14:30 -05:00
}
}
impl From<LoadSelf> for Instruction {
fn from(load_self: LoadSelf) -> Self {
let metadata = Operation::LoadSelf as u8;
let a = load_self.destination;
let b = 0;
let c = 0;
Instruction { metadata, a, b, c }
2024-11-26 07:14:30 -05:00
}
}