pub struct Runtime { /* private fields */ }
Expand description
A runtime context for wasm3 modules.
Implementations
sourceimpl Runtime
impl Runtime
sourcepub fn new(environment: &Environment, stack_size: u32) -> Result<Self>
pub fn new(environment: &Environment, stack_size: u32) -> Result<Self>
Creates a new runtime with the given stack size in slots.
Errors
This function will error on memory allocation failure.
sourcepub fn parse_and_load_module<TData: Into<Box<[u8]>>>(
&self,
bytes: TData
) -> Result<Module<'_>>
pub fn parse_and_load_module<TData: Into<Box<[u8]>>>(
&self,
bytes: TData
) -> Result<Module<'_>>
Parses and loads a module from bytes.
sourcepub fn load_module(&self, module: ParsedModule) -> Result<Module<'_>>
pub fn load_module(&self, module: ParsedModule) -> Result<Module<'_>>
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.
sourcepub fn find_function<ARGS, RET>(
&self,
name: &str
) -> Result<Function<'_, ARGS, RET>> where
ARGS: WasmArgs,
RET: WasmType,
pub fn find_function<ARGS, RET>(
&self,
name: &str
) -> Result<Function<'_, 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.
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more