[−][src]Struct brainfrsck::components::Memory
Component of the interpreter that handles virtual memory management
Methods
impl Memory
[src]
pub fn new() -> Self
[src]
pub fn pull(&self) -> u8
[src]
Called when the .
instruction is encountered.
Attempts to pull the value at the data pointer from memory
Should never panic, will panic if the data pointer is greater than 30,000, however, the
data pointer should never go higher than that (the program will return Err in memory.inc_ptr()
if the data pointer will be higher than 30,000)
pub fn push(&mut self, value: u8)
[src]
Called when the ,
instruction is encountered
Attempts to push the value into the memory location at the data pointer
See memory.pull()
for safety
pub fn inc_ptr(&mut self) -> Result<(), BrainfuckError>
[src]
Called when the >
instruction is encountered
Attempts to increment the data pointer
Returns Err
if the data pointer would pass the end of memory if incremented
pub fn dec_ptr(&mut self)
[src]
Called when the <
instruction is encountered
Attempts to decrement the data pointer
pub fn inc_val(&mut self)
[src]
Called when the +
instruction is encountered
Wrapping adds the value at the data pointer
pub fn dec_val(&mut self)
[src]
Called when the -
instruction is encountered
Wrapping subtracts the value at the data pointer
Trait Implementations
Auto Trait Implementations
impl Send for Memory
impl Sync for Memory
impl Unpin for Memory
impl UnwindSafe for Memory
impl RefUnwindSafe for Memory
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,