Struct cambridge_asm::exec::Context
source · [−]pub struct Context {
pub cmp: bool,
pub mar: usize,
pub acc: usize,
pub ix: usize,
pub flow_override_reg: bool,
pub mem: Memory,
pub ret: usize,
pub gprs: [usize; 30],
pub end: bool,
pub io: Io,
}
Expand description
Tracks state of the registers and memory during execution
Fields
cmp: bool
mar: usize
acc: usize
ix: usize
flow_override_reg: bool
mem: Memory
ret: usize
gprs: [usize; 30]
end: bool
io: Io
Implementations
sourceimpl Context
impl Context
pub fn new(mem: Memory) -> Self
pub fn with_io(mem: Memory, io: Io) -> Self
pub fn override_flow_control(&mut self)
sourcepub fn get_mut_register(&mut self, op: &Op) -> &mut usize
pub fn get_mut_register(&mut self, op: &Op) -> &mut usize
Panics
If op
is not a usize
register. To avoid this, check op
using Op::is_register
.
sourcepub fn get_register(&self, op: &Op) -> usize
pub fn get_register(&self, op: &Op) -> usize
Panics
If op
is not a usize
register. To avoid this, check op
using Op::is_register
.
sourcepub fn modify(&mut self, op: &Op, f: impl Fn(&mut usize)) -> PasmResult
pub fn modify(&mut self, op: &Op, f: impl Fn(&mut usize)) -> PasmResult
Panics
If op
is not writable. To avoid this, check op
using Op::is_read_write
.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for Context
impl !Send for Context
impl !Sync for Context
impl Unpin for Context
impl !UnwindSafe for Context
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more