Struct bf::state::State [−][src]
pub struct State { /* fields omitted */ }
The Brainfuck machine state.
Methods
impl State
[src]
impl State
pub fn new() -> Self
[src]
pub fn new() -> Self
Creates 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) -> Self
Creates 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) -> u8
Gets 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) -> usize
The memory capacity.
pub fn as_mut_ptr(&mut self) -> *mut u8
[src]
pub fn as_mut_ptr(&mut self) -> *mut u8
Gets 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 State
fn clone(&self) -> State
[src]
fn clone(&self) -> State
Returns 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 State
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Eq for State
[src]
impl Eq for State
impl PartialEq for State
[src]
impl PartialEq for State
fn eq(&self, other: &State) -> bool
[src]
fn eq(&self, other: &State) -> bool
This 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) -> bool
This method tests for !=
.
impl Default for State
[src]
impl Default for State