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

Method Set

table.go:86–96  ·  view source on GitHub ↗

Set sets an item in this table at the specified index. Returns an error if the index is out of bounds.

(store Storelike, idx uint64, val Val)

Source from the content-addressed store, hash-verified

84//
85// Returns an error if the index is out of bounds.
86func (t *Table) Set(store Storelike, idx uint64, val Val) error {
87 var raw_val C.wasmtime_val_t
88 val.initialize(store, &raw_val)
89 err := C.wasmtime_table_set(store.Context(), &t.val, C.uint64_t(idx), &raw_val)
90 C.wasmtime_val_unroot(&raw_val)
91 runtime.KeepAlive(store)
92 if err != nil {
93 return mkError(err)
94 }
95 return nil
96}
97
98// Type returns the underlying type of this table
99func (t *Table) Type(store Storelike) *TableType {

Callers 3

TestTableFunction · 0.95
TestRefTypesTableFunction · 0.95
ExampleVal_ExternrefFunction · 0.45

Calls 3

mkErrorFunction · 0.85
initializeMethod · 0.80
ContextMethod · 0.65

Tested by 3

TestTableFunction · 0.76
TestRefTypesTableFunction · 0.76
ExampleVal_ExternrefFunction · 0.36