inject example, some fixes

This commit is contained in:
NikVolf
2017-04-10 13:11:34 +03:00
parent 56d315f6c5
commit d09a59c6bc
7 changed files with 105 additions and 13 deletions

View File

@ -10,18 +10,21 @@ use super::{
pub struct Opcodes(Vec<Opcode>);
impl Opcodes {
/// New list of opcodes from vector of opcodes
/// New list of opcodes from vector of opcodes.
pub fn new(elements: Vec<Opcode>) -> Self {
Opcodes(elements)
}
/// Empty expression with only `Opcode::End` opcode
/// Empty expression with only `Opcode::End` opcode.
pub fn empty() -> Self {
Opcodes(vec![Opcode::End])
}
/// List of individual opcodes
/// List of individual opcodes.
pub fn elements(&self) -> &[Opcode] { &self.0 }
/// Individual opcodes, mutable.
pub fn elements_mut(&mut self) -> &mut Vec<Opcode> { &mut self.0 }
}
impl Deserialize for Opcodes {