[−][src]Struct rdcl_aoc_helpers::machine::Machine
A machine which can run instructions.
Fields
register: R
output_receiver: O
Implementations
impl<I: MachineInstruction> Machine<I, HashMapRegister, NoopOutputReceiver>
[src]
pub fn new_simple_machine(
instructions: &[I]
) -> Machine<I, HashMapRegister, NoopOutputReceiver>
[src]
instructions: &[I]
) -> Machine<I, HashMapRegister, NoopOutputReceiver>
Constructs a new machine which uses a HashMapRegister and the NoopOutputReceiver.
impl<I, R, O> Machine<I, R, O> where
I: MachineInstruction,
R: MachineRegister,
O: OutputReceiver<R>,
[src]
I: MachineInstruction,
R: MachineRegister,
O: OutputReceiver<R>,
pub fn new_machine(
instructions: &[I],
register: R,
output_receiver: O
) -> Machine<I, R, O>
[src]
instructions: &[I],
register: R,
output_receiver: O
) -> Machine<I, R, O>
Constructs a new machine where you specify your own register and output receiver.
pub fn run<H: PreExecuteHook<I>>(&mut self, pre_execute_hook: &mut H)
[src]
Let the program run.
pub fn get_counter(&self) -> i64
[src]
Returns the program counter.
pub fn get_instruction(&self, idx: i64) -> Option<(usize, I)>
[src]
Fetch the instruction at position idx
, if any.
pub fn set_instruction(&mut self, idx: i64, new_instruction: &I)
[src]
Replaces the instruction at position idx
, if any.
Auto Trait Implementations
impl<I, R, O> RefUnwindSafe for Machine<I, R, O> where
I: RefUnwindSafe,
O: RefUnwindSafe,
R: RefUnwindSafe,
[src]
I: RefUnwindSafe,
O: RefUnwindSafe,
R: RefUnwindSafe,
impl<I, R, O> Send for Machine<I, R, O> where
I: Send,
O: Send,
R: Send,
[src]
I: Send,
O: Send,
R: Send,
impl<I, R, O> Sync for Machine<I, R, O> where
I: Sync,
O: Sync,
R: Sync,
[src]
I: Sync,
O: Sync,
R: Sync,
impl<I, R, O> Unpin for Machine<I, R, O> where
I: Unpin,
O: Unpin,
R: Unpin,
[src]
I: Unpin,
O: Unpin,
R: Unpin,
impl<I, R, O> UnwindSafe for Machine<I, R, O> where
I: UnwindSafe,
O: UnwindSafe,
R: UnwindSafe,
[src]
I: UnwindSafe,
O: UnwindSafe,
R: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
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 = Infallible
The type returned in the event of a conversion error.
pub 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>,