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

Method snapshot_component

crates/wizer/src/component.rs:35–49  ·  view source on GitHub ↗

Same as [`Wizer::snapshot`], except for components.

(
        &self,
        mut cx: ComponentContext<'_>,
        instance: &mut impl ComponentInstanceState,
    )

Source from the content-addressed store, hash-verified

33
34 /// Same as [`Wizer::snapshot`], except for components.
35 pub async fn snapshot_component(
36 &self,
37 mut cx: ComponentContext<'_>,
38 instance: &mut impl ComponentInstanceState,
39 ) -> Result<Vec<u8>> {
40 if !self.func_renames.is_empty() {
41 bail!("components do not support renaming functions");
42 }
43
44 let snapshot = snapshot::snapshot(&cx, instance).await;
45 let rewritten_wasm = self.rewrite_component(&mut cx, &snapshot);
46 self.debug_assert_valid_wasm(&rewritten_wasm, "rewritten component");
47
48 Ok(rewritten_wasm)
49 }
50}
51
52/// Trait representing the ability to invoke functions on a component to learn

Callers 2

execute_asyncMethod · 0.80
run_componentMethod · 0.80

Calls 5

OkFunction · 0.85
rewrite_componentMethod · 0.80
snapshotFunction · 0.70
is_emptyMethod · 0.45

Tested by

no test coverage detected