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

Method Grow

table.go:54–66  ·  view source on GitHub ↗

Grow grows this table by the number of units specified, using the specified initializer value for new slots. Returns an error if the table failed to grow, or the previous size of the table if growth was successful.

(store Storelike, delta uint64, init Val)

Source from the content-addressed store, hash-verified

52// Returns an error if the table failed to grow, or the previous size of the
53// table if growth was successful.
54func (t *Table) Grow(store Storelike, delta uint64, init Val) (uint64, error) {
55 var prev C.uint64_t
56 var raw_val C.wasmtime_val_t
57 init.initialize(store, &raw_val)
58 err := C.wasmtime_table_grow(store.Context(), &t.val, C.uint64_t(delta), &raw_val, &prev)
59 C.wasmtime_val_unroot(&raw_val)
60 runtime.KeepAlive(store)
61 if err != nil {
62 return 0, mkError(err)
63 }
64
65 return uint64(prev), nil
66}
67
68// Get gets an item from this table from the specified index.
69//

Callers 3

TestTableFunction · 0.95
TestRefTypesTableFunction · 0.95
ExampleMemoryFunction · 0.45

Calls 3

mkErrorFunction · 0.85
initializeMethod · 0.80
ContextMethod · 0.65

Tested by 3

TestTableFunction · 0.76
TestRefTypesTableFunction · 0.76
ExampleMemoryFunction · 0.36