[][src]Struct wasm3::Runtime

pub struct Runtime { /* fields omitted */ }

A runtime context for wasm3 modules.

Implementations

impl Runtime[src]

pub fn new(environment: &Environment, stack_size: u32) -> Result<Self>[src]

Creates a new runtime with the given stack size in slots.

Errors

This function will error on memory allocation failure.

pub fn parse_and_load_module<'rt>(
    &'rt self,
    bytes: &[u8]
) -> Result<Module<'rt>>
[src]

Parses and loads a module from bytes.

pub fn load_module<'rt>(&'rt self, module: ParsedModule) -> Result<Module<'rt>>[src]

Loads a parsed module returning the module if unsuccessful.

Errors

This function will error if the module's environment differs from the one this runtime uses.

pub fn find_function<'rt, ARGS, RET>(
    &'rt self,
    name: &str
) -> Result<Function<'rt, ARGS, RET>> where
    ARGS: WasmArgs,
    RET: WasmType
[src]

Looks up a function by the given name in the loaded modules of this runtime. See Module::find_function for possible error cases.

pub fn find_module<'rt>(&'rt self, name: &str) -> Result<Module<'rt>>[src]

Searches for a module with the given name in the runtime's loaded modules.

Using this over searching through Runtime::modules is a bit more efficient as it works on the underlying CStrings directly and doesn't require an upfront length calculation.

pub fn modules<'rt>(&'rt self) -> impl Iterator<Item = Module<'rt>> + 'rt[src]

Returns an iterator over the runtime's loaded modules.

pub unsafe fn memory(&self) -> *const [u8][src]

Returns the raw memory of this runtime.

Safety

The returned pointer may get invalidated when wasm function objects are called due to reallocations.

pub unsafe fn memory_mut(&self) -> *mut [u8][src]

Returns the raw memory of this runtime.

Safety

The returned pointer may get invalidated when wasm function objects are called due to reallocations.

pub fn stack(&self) -> *const [m3slot_t][src]

Returns the stack of this runtime.

pub fn stack_mut(&self) -> *mut [m3slot_t][src]

Returns the stack of this runtime.

Trait Implementations

impl Debug for Runtime[src]

impl Drop for Runtime[src]

Auto Trait Implementations

impl !RefUnwindSafe for Runtime

impl !Send for Runtime

impl !Sync for Runtime

impl Unpin for Runtime

impl !UnwindSafe for Runtime

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.