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

Method serialize

crates/c-api/include/wasmtime/module.hh:152–164  ·  view source on GitHub ↗

* \brief Serializes this module to a list of bytes. * * The returned bytes can then be used to later pass to `deserialize` to * quickly recreate this module in a different process perhaps. */

Source from the content-addressed store, hash-verified

150 * quickly recreate this module in a different process perhaps.
151 */
152 Result<std::vector<uint8_t>> serialize() const {
153 wasm_byte_vec_t bytes;
154 auto *error = wasmtime_module_serialize(ptr.get(), &bytes);
155 if (error != nullptr) {
156 return Error(error);
157 }
158 std::vector<uint8_t> ret;
159 // NOLINTNEXTLINE TODO can this be done without triggering lints?
160 Span<uint8_t> raw(reinterpret_cast<uint8_t *>(bytes.data), bytes.size);
161 ret.assign(raw.begin(), raw.end());
162 wasm_byte_vec_delete(&bytes);
163 return ret;
164 }
165#endif // WASMTIME_FEATURE_COMPILER
166};
167

Callers 6

append_codeMethod · 0.45
wasm_module_serializeFunction · 0.45
TESTFunction · 0.45
TESTFunction · 0.45

Calls 6

assignMethod · 0.80
ErrorClass · 0.70
getMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by 2

TESTFunction · 0.36
TESTFunction · 0.36