Trait Model

Source
pub trait Model {
    type Output;

    // Required methods
    fn start(&mut self, cell: isize);
    fn clear(&mut self, cell: isize);
    fn mov(&mut self, cell: isize, to: Vec<isize>);
    fn top(&mut self, cell: isize);
    fn finish(self) -> Self::Output;
}
Expand description

The assumed model of computation

Required Associated Types§

Source

type Output

The final program output type

Required Methods§

Source

fn start(&mut self, cell: isize)

Sets the top of the stack to a given index

This function should generate a no-op. It is used just to communicate the starting state

Source

fn clear(&mut self, cell: isize)

Clears a cell to 0

Source

fn mov(&mut self, cell: isize, to: Vec<isize>)

Clears the data in a cell and copies it to a list of other cells

Source

fn top(&mut self, cell: isize)

Changes the top of the stack to a given index

Source

fn finish(self) -> Self::Output

Returns the final program output.

Implementors§