mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 05:49:08 +00:00
wasm_interp: create Instance::from_bytes
This commit is contained in:
parent
4d5b7f8b73
commit
4501f2af0e
1 changed files with 11 additions and 0 deletions
|
@ -93,6 +93,17 @@ impl<'a, I: ImportDispatcher> Instance<'a, I> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn from_bytes(
|
||||
arena: &'a Bump,
|
||||
module_bytes: &[u8],
|
||||
import_dispatcher: I,
|
||||
is_debug_mode: bool,
|
||||
) -> Result<Self, std::string::String> {
|
||||
let module =
|
||||
WasmModule::preload(arena, module_bytes, false).map_err(|e| format!("{:?}", e))?;
|
||||
Self::for_module(arena, arena.alloc(module), import_dispatcher, is_debug_mode)
|
||||
}
|
||||
|
||||
pub fn for_module(
|
||||
arena: &'a Bump,
|
||||
module: &'a WasmModule<'a>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue