MCPcopy Create free account
hub / github.com/explodingcamera/tinywasm / start

Method start

crates/tinywasm/src/instance.rs:676–681  ·  view source on GitHub ↗

Invoke the start function of the module Returns `None` if the module has no start function ## Example ```rust # fn main() -> tinywasm::Result<()> { # use tinywasm::{ModuleInstance, Store}; # let wasm = wat::parse_str(r#" # (module # (global $g (mut i32) (i32.const 0)) # (func (export "_start") # i32.const 7 # global.set $g) # (export "g" (global $g))) # "#).

(&self, store: &mut Store)

Source from the content-addressed store, hash-verified

674 ///
675 /// See <https://webassembly.github.io/spec/core/syntax/modules.html#syntax-start>
676 pub fn start(&self, store: &mut Store) -> Result<Option<()>> {
677 match self.start_func(store)? {
678 Some(func) => func.call(store, &[]).map(|_| Some(())),
679 None => Ok(None),
680 }
681 }
682}

Callers 3

runFunction · 0.80
instantiateMethod · 0.80

Calls 3

start_funcMethod · 0.80
mapMethod · 0.80
callMethod · 0.80