MCPcopy Create free account
hub / github.com/WasmEdge/WasmEdge / WasmEdge_Result WasmEdge_LoaderSerializeASTModule

Function WasmEdge_Result WasmEdge_LoaderSerializeASTModule

lib/api/wasmedge.cpp:2045–2060  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2043}
2044
2045WASMEDGE_CAPI_EXPORT WasmEdge_Result WasmEdge_LoaderSerializeASTModule(
2046 WasmEdge_LoaderContext *Cxt, const WasmEdge_ASTModuleContext *ASTCxt,
2047 WasmEdge_Bytes *Buf) noexcept {
2048 return wrap(
2049 [&]() {
2050 return fromLoaderCxt(Cxt)->serializeModule(*fromASTModCxt(ASTCxt));
2051 },
2052 [&](auto &&Res) {
2053 uint32_t Size = static_cast<uint32_t>((*Res).size());
2054 uint8_t *Bytes = new uint8_t[Size];
2055 std::copy_n((*Res).begin(), Size, Bytes);
2056 Buf->Length = Size;
2057 Buf->Buf = Bytes;
2058 },
2059 Cxt, ASTCxt, Buf);
2060}
2061
2062WASMEDGE_CAPI_EXPORT void
2063WasmEdge_LoaderDelete(WasmEdge_LoaderContext *Cxt) noexcept {

Callers

nothing calls this directly

Calls 4

wrapFunction · 0.85
serializeModuleMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected