[−][src]Struct wasm3::Runtime
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]
&'rt self,
bytes: &[u8]
) -> Result<Module<'rt>>
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]
&'rt self,
name: &str
) -> Result<Function<'rt, ARGS, RET>> where
ARGS: WasmArgs,
RET: WasmType,
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
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,