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

30 lines
651 B
Rust
Raw Normal View History

use crate::{Instruction, Operation};
2024-11-26 07:14:30 -05:00
pub struct GetLocal {
pub destination: u8,
pub local_index: u8,
2024-11-26 07:14:30 -05:00
}
impl From<&Instruction> for GetLocal {
fn from(instruction: &Instruction) -> Self {
let destination = instruction.a;
let local_index = instruction.b;
2024-11-26 07:14:30 -05:00
GetLocal {
destination,
local_index,
2024-11-26 07:14:30 -05:00
}
}
}
impl From<GetLocal> for Instruction {
fn from(get_local: GetLocal) -> Self {
let a = get_local.destination;
let b = get_local.local_index;
let c = 0;
let metadata = Operation::GetLocal as u8;
Instruction { metadata, a, b, c }
2024-11-26 07:14:30 -05:00
}
}