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

Function tinywasm_no_std

examples/wasm-rust.rs:88–101  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

86}
87
88fn tinywasm_no_std() -> Result<()> {
89 let module = tinywasm::parse_file("./examples/rust/out/tinywasm_no_std.wasm")?;
90 let mut store = Store::default();
91
92 let mut imports = Imports::new();
93 imports.define("env", "printi32", HostFunction::from(&mut store, |_: FuncContext<'_>, _x: i32| Ok(())));
94 let instance = ModuleInstance::instantiate(&mut store, &module, Some(black_box(imports)))?;
95
96 let hello = instance.func::<(), ()>(&store, "hello")?;
97 hello.call(&mut store, black_box(()))?;
98 hello.call(&mut store, black_box(()))?;
99 hello.call(&mut store, black_box(()))?;
100 Ok(())
101}
102
103fn hello() -> Result<()> {
104 let module = tinywasm::parse_file("./examples/rust/out/hello.opt.wasm")?;

Callers 2

mainFunction · 0.85
test_tinywasm_no_stdFunction · 0.85

Calls 3

parse_fileFunction · 0.85
defineMethod · 0.80
callMethod · 0.80

Tested by 1

test_tinywasm_no_stdFunction · 0.68