pub struct Program {
pub counter: usize,
/* private fields */
}
Expand description
A structure that contains the program logic and the program counter.
Fields§
§counter: usize
Implementations§
Source§impl Program
impl Program
Sourcepub fn current(&self) -> &Instruction
pub fn current(&self) -> &Instruction
Returns the current instruction. Panics if there are no instructions or the program counter is out of bounds.
Sourcepub fn step(&mut self) -> ProgramStatus
pub fn step(&mut self) -> ProgramStatus
Increases the program counter, returns ProgramStatus::Exit
if the program counter is >= to the length of the program.
Otherwise, returns ProgramStatus::Run
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Program
impl RefUnwindSafe for Program
impl Send for Program
impl Sync for Program
impl Unpin for Program
impl UnwindSafe for Program
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more