Struct stack_vm::Builder [] [src]

pub struct Builder<'a, T: 'a + Debug> {
    pub instruction_table: &'a InstructionTable<T>,
    pub instructions: Vec<usize>,
    pub labels: WriteOnceTable<usize>,
    pub data: Vec<T>,
}

The builder struct.

Contains: * an InstructionTable. * a list of instructions that have been pushed into this builder. * a Table of labels used for jumping. * a list of T to be stored in the builder's data section.

Fields

Methods

impl<'a, T: Debug> Builder<'a, T>
[src]

[src]

Create a new Builder from an InstructionTable.

[src]

Push an instruction into the code.

  • name should match that of an instruction in the InstructionTable.
  • args a vector of operands to be pushed into the builder's data section.

[src]

Insert a label at this point in the code.

Labels are used as targets for jumps. When you call this method a label is stored which points to the position of the next instruction.

[src]

Return the length of the instructions vector.

i.e. the number of instructions pushed so far.

Trait Implementations

impl<'a, T: 'a + Debug> Debug for Builder<'a, T>
[src]

[src]

Formats the value using the given formatter.