pub struct VMLogic<'a> { /* private fields */ }Expand description
The core logic controller for the VM.
This struct manages the state of an execution, including storage, memory, registers, and the results of the execution (logs, events, return values).
Implementations§
Source§impl<'a> VMLogic<'a>
impl<'a> VMLogic<'a>
Sourcepub fn new(
storage: &'a mut dyn Storage,
context: VMContext<'a>,
limits: &'a VMLimits,
node_client: Option<NodeClient>,
) -> Self
pub fn new( storage: &'a mut dyn Storage, context: VMContext<'a>, limits: &'a VMLimits, node_client: Option<NodeClient>, ) -> Self
Creates a new VMLogic instance.
§Arguments
storage- A mutable reference to the storage implementation.context- The execution context for the VM.limits- The VM resource limits to enforce.node_client- An optional client for blob storage operations.
Sourcepub fn with_memory(&mut self, memory: Memory) -> &mut Self
pub fn with_memory(&mut self, memory: Memory) -> &mut Self
Associates a Wasmer memory instance with this VMLogic.
This method should be called after the guest module is instantiated but before any host functions are called.
§Arguments
memory- Thewasmer::Memoryinstance from the instantiated guest module.
Sourcepub fn host_functions(&'a mut self, store: StoreMut<'a>) -> VMHostFunctions<'a>
pub fn host_functions(&'a mut self, store: StoreMut<'a>) -> VMHostFunctions<'a>
Source§impl VMLogic<'_>
impl VMLogic<'_>
Sourcepub fn finish(self, err: Option<FunctionCallError>) -> Outcome
pub fn finish(self, err: Option<FunctionCallError>) -> Outcome
Consumes the VMLogic instance and produces the final Outcome.
This method should be called after the guest function has finished executing
or has trapped. It packages the final state of the VMLogic into an
Outcome struct.
§Arguments
err- An optionalFunctionCallErrorthat occurred during execution (e.g., a trap). IfNone, the outcome is determined by thereturnsfield.
Auto Trait Implementations§
impl<'a> Freeze for VMLogic<'a>
impl<'a> !RefUnwindSafe for VMLogic<'a>
impl<'a> !Send for VMLogic<'a>
impl<'a> !Sync for VMLogic<'a>
impl<'a> Unpin for VMLogic<'a>
impl<'a> !UnwindSafe for VMLogic<'a>
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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
Source§impl<T> Constraint for T
impl<T> Constraint for T
Source§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Gets the layout of the type.