WasmModule.deserialize constructor
WasmModule.deserialize(
- WasmEngine engine,
- Uint8List bytes
Loads a module from bytes produced by serialize.
Implementation
factory WasmModule.deserialize(WasmEngine engine, Uint8List bytes) =>
scoped((arena) {
final (data, length) = copyBytes(arena, bytes);
final out = arena<ffi.Pointer<c.wasmtime_module_t>>();
throwIfError(
c.wasmtime_module_deserialize(engine.pointer, data, length, out),
);
if (out.value == ffi.nullptr) {
throw WasmtimeException(
'wasmtime_module_deserialize() produced no module',
);
}
return WasmModule._(engine, out.value);
});