[][src]Struct intcodeint::Machine

pub struct Machine<I, O> { /* fields omitted */ }

An instance of an Intcode virtual machine.

Methods

impl<I, O> Machine<I, O> where
    I: Iterator<Item = isize>,
    O: FnMut(isize), 
[src]

pub fn new(input: I, output: O) -> Machine<I, O>[src]

Constructs a new machine with the given I/O callbacks and the initial state:

  • empty mem;
  • ip pointing to zero;
  • base set at zero.

pub fn mem(&self) -> &[isize][src]

An immutable view into the virtual machine's memory.

pub fn mem_mut(&mut self) -> &mut [isize][src]

A mutable view into the virtual machine's memory.

pub fn reserve(&mut self, size: usize)[src]

Ensures that memory locations 0..size are valid, extending memory with zeroes if needed.

pub fn copy(&mut self, start: usize, values: &[isize])[src]

Copies the given slice into memory at the given location.

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

Executes a single instruction.

pub fn run(&mut self) -> Error[src]

Runs the program until the first error is encountered.

Trait Implementations

impl<I: Debug, O: Debug> Debug for Machine<I, O>[src]

Auto Trait Implementations

impl<I, O> Send for Machine<I, O> where
    I: Send,
    O: Send

impl<I, O> Sync for Machine<I, O> where
    I: Sync,
    O: Sync

impl<I, O> Unpin for Machine<I, O> where
    I: Unpin,
    O: Unpin

impl<I, O> UnwindSafe for Machine<I, O> where
    I: UnwindSafe,
    O: UnwindSafe

impl<I, O> RefUnwindSafe for Machine<I, O> where
    I: RefUnwindSafe,
    O: RefUnwindSafe

Blanket Implementations

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

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

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]