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

Method instantiate

crates/wasmtime/src/runtime/component/linker.rs:301–309  ·  view source on GitHub ↗

Instantiates the [`Component`] provided into the `store` specified. This function will use the items defined within this [`Linker`] to satisfy the imports of the [`Component`] provided as necessary. For more information about this see [`Linker::instantiate_pre`] as well. # Errors Returns an error if this [`Linker`] doesn't define an import that `component` requires or if it is of the wrong type

(
        &self,
        mut store: impl AsContextMut<Data = T>,
        component: &Component,
    )

Source from the content-addressed store, hash-verified

299 /// memory allocation fails. See the `OutOfMemory` type's documentation for
300 /// details on Wasmtime's out-of-memory handling.
301 pub fn instantiate(
302 &self,
303 mut store: impl AsContextMut<Data = T>,
304 component: &Component,
305 ) -> Result<Instance> {
306 let store = store.as_context_mut();
307 store.0.validate_sync_call()?;
308 self.instantiate_pre(component)?.instantiate(store)
309 }
310
311 /// Instantiates the [`Component`] provided into the `store` specified.
312 ///

Callers

nothing calls this directly

Calls 3

validate_sync_callMethod · 0.80
as_context_mutMethod · 0.45
instantiate_preMethod · 0.45

Tested by

no test coverage detected