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)
| 52 | // Returns an error if the table failed to grow, or the previous size of the |
| 53 | // table if growth was successful. |
| 54 | func (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 | // |