Struct bf::state::State [−][src]
pub struct State { /* fields omitted */ }The Brainfuck machine state.
Methods
impl State[src]
impl Statepub fn new() -> Self[src]
pub fn new() -> SelfCreates a new BF machine state with memory capacity
DEFAULT_CAPACITY (30_000).
pub fn with_capacity(memory_size: usize) -> Self[src]
pub fn with_capacity(memory_size: usize) -> SelfCreates a new BF machine state with the given memory capacity.
pub fn left<C: IntoUsize>(&mut self, count: C) -> BfResult<()>[src]
pub fn left<C: IntoUsize>(&mut self, count: C) -> BfResult<()>pub fn right<C: IntoUsize>(&mut self, count: C) -> BfResult<()>[src]
pub fn right<C: IntoUsize>(&mut self, count: C) -> BfResult<()>pub fn up(&mut self, count: u8)[src]
pub fn up(&mut self, count: u8)Increments/increases the byte at the pointer.
Wraps around modulo 256.
pub fn down(&mut self, count: u8)[src]
pub fn down(&mut self, count: u8)Decrements/decreases the byte at the pointer.
Wraps around modulo 256.
pub fn load(&self) -> u8[src]
pub fn load(&self) -> u8Gets the value of the byte at the pointer.
pub fn store(&mut self, value: u8)[src]
pub fn store(&mut self, value: u8)Sets the value of the byte at the pointer.
pub fn up_pos_offset<C: IntoUsize>(
&mut self,
offset: C,
value: u8
) -> BfResult<()>[src]
pub fn up_pos_offset<C: IntoUsize>(
&mut self,
offset: C,
value: u8
) -> BfResult<()>Adds the given value at the given positive offset from the pointer.
pub fn up_neg_offset<C: IntoUsize>(
&mut self,
offset: C,
value: u8
) -> BfResult<()>[src]
pub fn up_neg_offset<C: IntoUsize>(
&mut self,
offset: C,
value: u8
) -> BfResult<()>Adds the given value at the given negative offset from the pointer.
pub fn read<R: Read>(&mut self, input: &mut R)[src]
pub fn read<R: Read>(&mut self, input: &mut R)Reads from a Read into the byte at the pointer.
pub fn write<W: Write>(&self, output: &mut W)[src]
pub fn write<W: Write>(&self, output: &mut W)Writes to a Write from the byte at the pointer.
pub fn capacity(&self) -> usize[src]
pub fn capacity(&self) -> usizeThe memory capacity.
pub fn as_mut_ptr(&mut self) -> *mut u8[src]
pub fn as_mut_ptr(&mut self) -> *mut u8Gets a mutable, raw pointer to the start of memory.
This is used by the JIT RTS to pass the memory pointer to the generated code.
Trait Implementations
impl Clone for State[src]
impl Clone for Statefn clone(&self) -> State[src]
fn clone(&self) -> StateReturns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)Performs copy-assignment from source. Read more
impl Debug for State[src]
impl Debug for Statefn fmt(&self, f: &mut Formatter) -> Result[src]
fn fmt(&self, f: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl Eq for State[src]
impl Eq for Stateimpl PartialEq for State[src]
impl PartialEq for Statefn eq(&self, other: &State) -> bool[src]
fn eq(&self, other: &State) -> boolThis method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, other: &State) -> bool[src]
fn ne(&self, other: &State) -> boolThis method tests for !=.
impl Default for State[src]
impl Default for State