pub struct Core { /* private fields */ }
Expand description
The full memory core at a given point in time
Implementations§
Source§impl Core
impl Core
Sourcepub fn new(core_size: u32) -> Result<Self, Error>
pub fn new(core_size: u32) -> Result<Self, Error>
Create a new Core with the given number of possible instructions.
pub fn steps_taken(&self) -> usize
Sourcepub fn len(&self) -> u32
pub fn len(&self) -> u32
Get the number of instructions in the core (available to programs
via the CORESIZE
label)
Sourcepub fn get(&self, index: i32) -> &Instruction
pub fn get(&self, index: i32) -> &Instruction
Get an instruction from a given index in the core
Sourcepub fn get_mut(&mut self, index: i32) -> &mut Instruction
pub fn get_mut(&mut self, index: i32) -> &mut Instruction
Get a mutable instruction from a given index in the core
Sourcepub fn load_warrior(&mut self, warrior: &Warrior) -> Result<(), Error>
pub fn load_warrior(&mut self, warrior: &Warrior) -> Result<(), Error>
Load a Warrior
into the core starting at the front (first instruction of the core).
Returns an error if the Warrior was too long to fit in the core, or had unresolved labels
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Core
impl RefUnwindSafe for Core
impl Send for Core
impl Sync for Core
impl Unpin for Core
impl UnwindSafe for Core
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