diff --git a/lib/interface-types/src/instructions/interpreter.rs b/lib/interface-types/src/instructions/interpreter.rs index 61c113343..ee1b8c48c 100644 --- a/lib/interface-types/src/instructions/interpreter.rs +++ b/lib/interface-types/src/instructions/interpreter.rs @@ -1,12 +1,11 @@ use crate::instructions::{stack::Stack, Instruction}; use std::convert::TryFrom; -type ExecutableInstruction = dyn Fn(&mut Stack); -//trait ExecutableInstruction: Fn(&mut Stack) {} +type ExecutableInstruction = Box; pub(crate) struct Interpreter { stack: Stack, - instructions: Vec>, + instructions: Vec, } impl Interpreter { @@ -21,7 +20,7 @@ impl<'binary_input> TryFrom<&Vec>> for Interpreter { fn try_from(instructions: &Vec) -> Result { let executable_instructions = instructions .iter() - .map(|instruction| -> Box { + .map(|instruction| -> ExecutableInstruction { match instruction { Instruction::ArgumentGet(index) => { let index = index.to_owned(); @@ -50,7 +49,7 @@ impl<'binary_input> TryFrom<&Vec>> for Interpreter { _ => unimplemented!(), } }) - .collect::>(); + .collect(); Ok(Interpreter { stack: Stack::new(),