[][src]Struct intcode::IntcodeVM

pub struct IntcodeVM { /* fields omitted */ }

Methods

impl IntcodeVM[src]

pub fn new<D: Into<Vec<i64>>>(data: D) -> Self[src]

Create a new VM from some existing memory

pub fn from_stdin() -> Result<Self>[src]

Read a comma-separated list of integers from stdin and make it into a VM

pub fn current_opcode(&self) -> Result<i64, ExecutionError>[src]

Get the opcode pointed to by the current PC

pub fn get_memory(&self, index: usize) -> Result<i64, ExecutionError>[src]

Get the value of memory at a given index

pub fn set_memory(
    &mut self,
    index: usize,
    value: i64
) -> Result<(), ExecutionError>
[src]

Set the value of memory at a given index

pub fn get_memory_by_pointer(&self, index: usize) -> Result<i64, ExecutionError>[src]

Get the value at the memory location pointed to by the value at the given index

pub fn set_memory_by_pointer(
    &mut self,
    index: usize,
    value: i64
) -> Result<(), ExecutionError>
[src]

Set the value at the memory location pointed to by the value at the given index

pub fn memory(&self) -> &[i64][src]

Get the entire memory as a slice

pub fn step(&mut self) -> Result<bool, ExecutionError>[src]

Take a single step through the program

Returns true if the program can continue, or false if the program should halt.

If called again on an already halted program, returns Err(AlreadyHalted).

pub fn run_to_end(&mut self) -> Result<(), ExecutionError>[src]

Run the program until it halts

pub fn halted(&self) -> bool[src]

Check if the VM has halted

Trait Implementations

impl Clone for IntcodeVM[src]

impl Debug for IntcodeVM[src]

Auto Trait Implementations

Blanket Implementations

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

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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

type Error = !

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]