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

Method anyref

crates/c-api/include/wasmtime/val.hh:51–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49inline Val::Val(AnyRef ptr) : Val(std::optional(ptr)) {}
50
51inline std::optional<AnyRef> Val::anyref() const {
52 if (val.kind != WASMTIME_ANYREF) {
53 std::abort();
54 }
55 if (wasmtime_anyref_is_null(&val.of.anyref)) {
56 return std::nullopt;
57 }
58 wasmtime_anyref_t other;
59 wasmtime_anyref_clone(&val.of.anyref, &other);
60 return AnyRef(other);
61}
62
63inline Val::Val(std::optional<ExternRef> ptr) : val{} {
64 val.kind = WASMTIME_EXTERNREF;

Callers 7

miri_gc_smoke_testFunction · 0.45
i31ref_global_getFunction · 0.45
i31ref_global_setFunction · 0.45
mainFunction · 0.45
TESTFunction · 0.45

Calls 3

abortFunction · 0.85
wasmtime_anyref_is_nullFunction · 0.85
AnyRefClass · 0.70

Tested by 5

i31ref_global_getFunction · 0.36
i31ref_global_setFunction · 0.36
TESTFunction · 0.36