Engine

Struct Engine 

Source
pub struct Engine<'a, M>
where M: MemoryProvider,
{ /* private fields */ }
Expand description

The Engine is an interpreter for ΑΩ-operations and is used to execute basic blocks. After execution you can inspect the concrete values of registers / memory / ΑΩ-variables.

Implementations§

Source§

impl<'a, M> Engine<'a, M>
where M: MemoryProvider,

Source

pub fn attach(bb: &'a BasicBlock, memory: Option<&'a mut M>) -> Self

Attach this engine to a BasicBlock that you want to execute. Optionally you can pass a MemoryProvider that handles the memory loads and stores of the given basic block.

Source

pub fn event(&self) -> Option<EventId>

After execution, this is set if the basic block threw an event

Source

pub fn event_channel(&self) -> &[Var]

Access the event channel that the basic block wrote to

Source

pub fn set_register(&mut self, reg: &Register, value: Value)

Set the contents of a given register to a given value

Source

pub fn get_register(&self, reg: &Register) -> &Value

Get the contents of a given register

Source

pub fn memory(&self) -> Option<&M>

Get the memory subsystem

Source

pub fn memory_mut(&mut self) -> Option<&mut M>

Get the memory subsystem

Source

pub fn vars(&self) -> &[Value]

Get the concrete values of all ΑΩ-variables after execution

Source

pub fn var(&self, var: Var) -> &Value

Get the concrete value of a given ΑΩ-variable after execution

Source

pub fn jump(&self) -> Option<&JumpTarget>

If the basic block ended with some kind of jump, this value is set

Source

pub fn execute(&mut self) -> Result<(), EngineError>

Execute all the ΑΩ-operations inside the attached basic block

Auto Trait Implementations§

§

impl<'a, M> Freeze for Engine<'a, M>

§

impl<'a, M> RefUnwindSafe for Engine<'a, M>
where M: RefUnwindSafe,

§

impl<'a, M> Send for Engine<'a, M>
where M: Send,

§

impl<'a, M> Sync for Engine<'a, M>
where M: Sync,

§

impl<'a, M> Unpin for Engine<'a, M>

§

impl<'a, M> !UnwindSafe for Engine<'a, M>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.