MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime-go / Serialize

Method Serialize

component_feat_component_model.go:76–86  ·  view source on GitHub ↗

Serialize encodes this component as a sequence of bytes which can later be passed to [NewComponentDeserialize] to recover the same component without recompiling.

()

Source from the content-addressed store, hash-verified

74// passed to [NewComponentDeserialize] to recover the same component without
75// recompiling.
76func (c *Component) Serialize() ([]byte, error) {
77 retVec := C.wasm_byte_vec_t{}
78 err := C.wasmtime_component_serialize(c.ptr(), &retVec)
79 runtime.KeepAlive(c)
80 if err != nil {
81 return nil, mkError(err)
82 }
83 ret := C.GoBytes(unsafe.Pointer(retVec.data), C.int(retVec.size))
84 C.wasm_byte_vec_delete(&retVec)
85 return ret, nil
86}
87
88// NewComponentDeserialize decodes serialized bytes previously produced by
89// [Component.Serialize] back into a [Component].

Callers

nothing calls this directly

Calls 2

ptrMethod · 0.95
mkErrorFunction · 0.85

Tested by

no test coverage detected