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

Function NewTableType

tabletype.go:19–32  ·  view source on GitHub ↗

NewTableType creates a new `TableType` with the `element` type provided as well as limits on its size. The `min` value is the minimum size, in elements, of this table. The `has_max` boolean indicates whether a maximum size is present, and if so `max` is used as the maximum size of the table, in ele

(element *ValType, min uint32, has_max bool, max uint32)

Source from the content-addressed store, hash-verified

17// `has_max` boolean indicates whether a maximum size is present, and if so
18// `max` is used as the maximum size of the table, in elements.
19func NewTableType(element *ValType, min uint32, has_max bool, max uint32) *TableType {
20 valptr := C.wasm_valtype_new(C.wasm_valtype_kind(element.ptr()))
21 runtime.KeepAlive(element)
22 if !has_max {
23 max = 0xffffffff
24 }
25 limitsFFI := C.wasm_limits_t{
26 min: C.uint32_t(min),
27 max: C.uint32_t(max),
28 }
29 ptr := C.wasm_tabletype_new(valptr, &limitsFFI)
30
31 return mkTableType(ptr, nil)
32}
33
34func mkTableType(ptr *C.wasm_tabletype_t, owner interface{}) *TableType {
35 tabletype := &TableType{_ptr: ptr, _owner: owner}

Callers 3

TestTableFunction · 0.85
TestRefTypesTableFunction · 0.85
TestTableTypeFunction · 0.85

Calls 2

mkTableTypeFunction · 0.85
ptrMethod · 0.45

Tested by 3

TestTableFunction · 0.68
TestRefTypesTableFunction · 0.68
TestTableTypeFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…