[−][src]Struct intcodeint::Machine
An instance of an Intcode virtual machine.
Methods
impl<I, O> Machine<I, O> where
I: Iterator<Item = isize>,
O: FnMut(isize),
[src]
I: Iterator<Item = isize>,
O: FnMut(isize),
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
Auto Trait Implementations
impl<I, O> Send for Machine<I, O> where
I: Send,
O: Send,
I: Send,
O: Send,
impl<I, O> Sync for Machine<I, O> where
I: Sync,
O: Sync,
I: Sync,
O: Sync,
impl<I, O> Unpin for Machine<I, O> where
I: Unpin,
O: Unpin,
I: Unpin,
O: Unpin,
impl<I, O> UnwindSafe for Machine<I, O> where
I: UnwindSafe,
O: UnwindSafe,
I: UnwindSafe,
O: UnwindSafe,
impl<I, O> RefUnwindSafe for Machine<I, O> where
I: RefUnwindSafe,
O: RefUnwindSafe,
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]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
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,