From 56bbe8efe380b9d703f20d418a3a7732004e2165 Mon Sep 17 00:00:00 2001 From: Reuben Dunnington Date: Tue, 14 May 2024 08:51:10 -0700 Subject: [PATCH] update README code sample --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index cc686be..0306a2f 100644 --- a/README.md +++ b/README.md @@ -56,15 +56,15 @@ pub fn main() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; var allocator: std.mem.Allocator = gpa.allocator(); - var wasm_data: []u8 = try std.fs.cwd().readFileAlloc(allocator, "example.wasm", 1024 * 128); + const wasm_data: []u8 = try std.fs.cwd().readFileAlloc(allocator, "example.wasm", 1024 * 128); defer allocator.free(wasm_data); - var module_definition = bytebox.ModuleDefinition.init(allocator, .{}); - defer module_definition.deinit(); - try module_definition.decode(wasm_data); + const module_def = try bytebox.createModuleDefinition(allocator, .{}); + defer module_def.destroy(); + try module_def.decode(wasm_data); - var module_instance = bytebox.ModuleInstance.init(&module_definition, allocator); - defer module_instance.deinit(); + const module_instance = try bytebox.createModuleInstance(.Stack, module_def, allocator); + defer module_instance.destroy(); try module_instance.instantiate(.{}); } ```