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

24 lines
545 B
Rust
Raw Normal View History

2024-11-26 07:14:30 -05:00
use crate::{Instruction, Operation};
pub struct GetLocal {
pub destination: u16,
pub local_index: u16,
}
impl From<&Instruction> for GetLocal {
fn from(instruction: &Instruction) -> Self {
GetLocal {
destination: instruction.a(),
local_index: instruction.b(),
}
}
}
impl From<GetLocal> for Instruction {
fn from(get_local: GetLocal) -> Self {
*Instruction::new(Operation::GetLocal)
.set_a(get_local.destination)
.set_b(get_local.local_index)
}
}