Skip to main content

Vm

Struct Vm 

Source
pub struct Vm<'a, H: Host> { /* private fields */ }
Expand description

The virtual machine.

Implementations§

Source§

impl<'a, H: Host> Vm<'a, H>

Source

pub fn new(chunk: &'a Chunk, host: &'a mut H, budget: Budget) -> Self

Create a new VM for executing the given chunk.

Source

pub fn with_extension_governance( self, call_context: CallExecutionContext, sentinel_gate: Option<&'a mut dyn SentinelPolicyGate>, ) -> Self

Configures governed extension execution (CallExecutionContext + optional SentinelPolicyGate).

Source

pub fn extension_registry_mut(&mut self) -> &mut ExtensionRegistry<'a>

Mutable reference to the VM’s ExtensionRegistry.

Source

pub fn last_extension_outcome(&self) -> Option<&DispatchOutcome>

Returns the most recent extension DispatchOutcome (receipt + audit NQuin48s), if any.

Source

pub fn run(&mut self) -> Result<Value, VmError>

Execute the chunk’s top-level preamble and return the last value on the stack.

Source

pub fn call_function( &mut self, fn_idx: u16, args: &[Value], ) -> Result<Value, VmError>

Execute a specific user function by index with the given arguments.

Auto Trait Implementations§

§

impl<'a, H> !RefUnwindSafe for Vm<'a, H>

§

impl<'a, H> !Send for Vm<'a, H>

§

impl<'a, H> !Sync for Vm<'a, H>

§

impl<'a, H> !UnwindSafe for Vm<'a, H>

§

impl<'a, H> Freeze for Vm<'a, H>

§

impl<'a, H> Unpin for Vm<'a, H>

§

impl<'a, H> UnsafeUnpin for Vm<'a, 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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

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.

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>