[−][src]Struct intcode::IntcodeVM
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 push_input(&mut self, input: i64)
[src]
Add a single input value to the end of the input queue
pub fn push_inputs<I: IntoIterator<Item = i64>>(&mut self, input: I)
[src]
Add input values from an interator to the end of the input queue
pub fn pop_output(&mut self) -> Option<i64>
[src]
Pop values off the front of the output queue
pub fn current_raw_opcode(&self) -> Result<i64, ExecutionError>
[src]
Get the raw opcode value 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]
&mut self,
index: usize,
value: i64
) -> Result<(), ExecutionError>
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]
&mut self,
index: usize,
value: i64
) -> Result<(), ExecutionError>
Set the value at the memory location pointed to by the value at the given index
pub fn get_parameter(
&mut self,
mode: ParameterMode,
offset: usize
) -> Result<i64, ExecutionError>
[src]
&mut self,
mode: ParameterMode,
offset: usize
) -> Result<i64, ExecutionError>
Get the parameter based on the given value and the mode
pub fn set_parameter(
&mut self,
mode: ParameterMode,
offset: usize,
value: i64
) -> Result<(), ExecutionError>
[src]
&mut self,
mode: ParameterMode,
offset: usize,
value: i64
) -> Result<(), ExecutionError>
Set the parameter based on the given value and the mode
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
Auto Trait Implementations
impl Send for IntcodeVM
impl Sync for IntcodeVM
impl Unpin for IntcodeVM
impl UnwindSafe for IntcodeVM
impl RefUnwindSafe for IntcodeVM
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> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
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,