MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / initialize_component

Method initialize_component

crates/wizer/src/component/wasmtime.rs:60–75  ·  view source on GitHub ↗
(
        &self,
        store: &mut Store<T>,
        instance: &Instance,
        index: ComponentExportIndex,
    )

Source from the content-addressed store, hash-verified

58 }
59
60 async fn initialize_component<T: Send>(
61 &self,
62 store: &mut Store<T>,
63 instance: &Instance,
64 index: ComponentExportIndex,
65 ) -> wasmtime::Result<()> {
66 let init_func = instance
67 .get_typed_func::<(), ()>(&mut *store, index)
68 .expect("checked by `validate_init_func`");
69 init_func
70 .call_async(&mut *store, ())
71 .await
72 .with_context(|| format!("the initialization function trapped"))?;
73
74 Ok(())
75 }
76}
77
78/// Implementation of [`ComponentInstanceState`] backed by Wasmtime.

Callers 1

run_componentMethod · 0.80

Calls 4

OkFunction · 0.85
with_contextMethod · 0.80
expectMethod · 0.45
call_asyncMethod · 0.45

Tested by

no test coverage detected