Trait brainfuck::tape::Tape [] [src]

pub trait Tape: Deref<Target=u8> + DerefMut {
    type Cell;
    fn is_nice() -> bool;
    fn inc_val(&mut self) -> Result<Self::Cell, Error>;
    fn dec_val(&mut self) -> Result<Self::Cell, Error>;
    fn inc_ptr(&mut self) -> Result<usize, Error>;
    fn dec_ptr(&mut self) -> Result<usize, Error>;
}

An interface for the underlying data for brainfuck. Tapes are conceptually a sequential list of cells, who's values can be represented as bytes.

Associated Types

type Cell

The underlying cell type, that holds the data. This value when dereferenced will need to be converted to a u8.

Required Methods

fn is_nice() -> bool

Returns true if this tape is nice, meaning that it upholds the expectations of most brainfuck programs.

fn inc_val(&mut self) -> Result<Self::Cell, Error>

Increment the value of the current cell by 1.

fn dec_val(&mut self) -> Result<Self::Cell, Error>

Decrement the value of the current cell by 1.

fn inc_ptr(&mut self) -> Result<usize, Error>

Increment the location of the pointer by 1 cell.

fn dec_ptr(&mut self) -> Result<usize, Error>

Decrement the location of the pointer by 1 cell.

Implementors