[][src]Struct brainfrsck::components::Memory

pub struct Memory { /* fields omitted */ }

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

impl Debug for Memory[src]

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]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]