github.com/moontrade/wavm-go@v0.3.2-0.20220316110326-d229dd66ad65/table_type.go (about)

     1  package wavm
     2  
     3  // #include <stdlib.h>
     4  // #include "wavm-c.h"
     5  import "C"
     6  import "unsafe"
     7  
     8  type TableType C.wasm_tabletype_t
     9  
    10  func NewTableType(t *ValType, limits *Limits, shared Shared, index int) *TableType {
    11  	return (*TableType)(C.wasm_tabletype_new(
    12  		(*C.wasm_valtype_t)(t),
    13  		(*C.wasm_limits_t)(unsafe.Pointer(limits)),
    14  		(C.wasm_shared_t)(shared),
    15  		(C.wasm_index_t)(index),
    16  	))
    17  }
    18  
    19  func (t *TableType) Close() error {
    20  	t.Delete()
    21  	return nil
    22  }
    23  
    24  func (t *TableType) Delete() {
    25  	C.wasm_tabletype_delete((*C.wasm_tabletype_t)(t))
    26  }
    27  
    28  func (t *TableType) Element() *ValType {
    29  	return (*ValType)(C.wasm_tabletype_element((*C.wasm_tabletype_t)(t)))
    30  }
    31  
    32  func (t *TableType) Limits() *Limits {
    33  	return (*Limits)(unsafe.Pointer(C.wasm_tabletype_limits((*C.wasm_tabletype_t)(t))))
    34  }
    35  
    36  func (t *TableType) Shared() Shared {
    37  	return (Shared)(C.wasm_tabletype_shared((*C.wasm_tabletype_t)(t)))
    38  }