MCPcopy Index your code
hub / github.com/explodingcamera/tinywasm / main

Function main

examples/simple2.rs:12–21  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

10"#;
11
12fn main() -> Result<()> {
13 let wasm = wat::parse_str(WASM).expect("failed to parse wat");
14 let module = tinywasm::parse_bytes(&wasm)?;
15 let mut store = Store::default();
16 let instance = ModuleInstance::instantiate(&mut store, &module, None)?;
17 let add = instance.func::<(i32, i64), (i32, i64)>(&store, "return")?;
18
19 assert_eq!(add.call(&mut store, (1, 2))?, (1, 2));
20 Ok(())
21}

Callers

nothing calls this directly

Calls 1

parse_bytesFunction · 0.85

Tested by

no test coverage detected