MCPcopy Create free account
hub / github.com/WasmEdge/WasmEdge / fillMap

Function fillMap

lib/api/wasmedge.cpp:336–351  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

334// Helper function for retrieving exported maps.
335template <typename T>
336inline uint32_t fillMap(const std::map<std::string, T *, std::less<>> &Map,
337 WasmEdge_String *Names, const uint32_t Len) noexcept {
338 uint32_t I = 0;
339 for (auto &&Pair : Map) {
340 if (I >= Len) {
341 break;
342 }
343 if (Names) {
344 Names[I] = WasmEdge_String{
345 /* Length */ static_cast<uint32_t>(Pair.first.length()),
346 /* Buf */ Pair.first.data()};
347 }
348 I++;
349 }
350 return static_cast<uint32_t>(Map.size());
351}
352
353// Helper functions of context conversions.
354#define CONVTO(SIMP, INST, NAME, QUANT) \

Calls 2

dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected