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

Method Get

table.go:73–81  ·  view source on GitHub ↗

Get gets an item from this table from the specified index. Returns an error if the index is out of bounds, or returns a value (which may be internally null) if the index is in bounds corresponding to the entry at the specified index.

(store Storelike, idx uint64)

Source from the content-addressed store, hash-verified

71// may be internally null) if the index is in bounds corresponding to the entry
72// at the specified index.
73func (t *Table) Get(store Storelike, idx uint64) (Val, error) {
74 var val C.wasmtime_val_t
75 ok := C.wasmtime_table_get(store.Context(), &t.val, C.uint64_t(idx), &val)
76 runtime.KeepAlive(store)
77 if !ok {
78 return Val{}, errors.New("index out of bounds")
79 }
80 return takeVal(store, &val), nil
81}
82
83// Set sets an item in this table at the specified index.
84//

Callers 2

TestTableFunction · 0.95
TestRefTypesTableFunction · 0.95

Calls 2

takeValFunction · 0.85
ContextMethod · 0.65

Tested by 2

TestTableFunction · 0.76
TestRefTypesTableFunction · 0.76