Skip to main content

NativeEngine

Struct NativeEngine 

Source
pub struct NativeEngine<'m, 'h, H: Host> { /* private fields */ }
Expand description

The native semantic engine over a verified program.

'm bounds the module and entry table; 'h bounds the host borrow. The embedded Machine owns the shared heap/globals/host/limits and every value-semantic method; the engine never calls Machine::run. All mutable state is behind RefCell/Cell because NativeOps dispatches on &self (see the module docs on re-entrancy).

Implementations§

Source§

impl<'m, 'h, H: Host> NativeEngine<'m, 'h, H>

Source

pub fn new( program: &'m Program<Verified>, entries: &'m dyn NativeEntryTable, host: &'h mut H, limits: Limits, ) -> Self
where 'm: 'h,

A native engine that drives control flow itself (the compiler-free reference backend). entries is used only for nested calls under the linked backend; the reference backend recurses internally.

Source

pub fn stdout(&self) -> Vec<u8>

Buffered process stdout produced during execution.

Source

pub fn exit_code(&self) -> i32

The process exit code.

Source

pub fn run(self) -> Result<Execution, RuntimeError>

Executes the program entry with the reference driver. Never invokes Machine::run.

Trait Implementations§

Source§

impl<'m, 'h, H: Host> NativeOps for NativeEngine<'m, 'h, H>

Source§

fn truthy(&self, _frame: &mut NativeFrame<'_>, value: Value) -> bool

The total ToBoolean coercion. Never throws.
Source§

fn dispatch( &self, frame: &mut NativeFrame<'_>, call: HelperCall, ) -> HelperResult

Executes one completion helper, writing any register side effects through frame and returning the completion.

Auto Trait Implementations§

§

impl<'m, 'h, H> !Freeze for NativeEngine<'m, 'h, H>

§

impl<'m, 'h, H> !RefUnwindSafe for NativeEngine<'m, 'h, H>

§

impl<'m, 'h, H> !Send for NativeEngine<'m, 'h, H>

§

impl<'m, 'h, H> !Sync for NativeEngine<'m, 'h, H>

§

impl<'m, 'h, H> !UnwindSafe for NativeEngine<'m, 'h, H>

§

impl<'m, 'h, H> Unpin for NativeEngine<'m, 'h, H>

§

impl<'m, 'h, H> UnsafeUnpin for NativeEngine<'m, 'h, H>

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.