wasmedge-hs-0.17.1.0: Haskell bindings for the WasmEdge WebAssembly runtime
Copyright(c) 2026 Tushar Adhatrao
LicenseMIT
Stabilitystable
Safe HaskellNone
LanguageGHC2021

WasmEdge.Table

Description

Provides types and functions for WebAssembly table instances and types:

Synopsis

Table type

data TableType #

A WebAssembly table type, specifying the reference type (FuncRef or ExternRef) and element limits.

createTableType :: ValType -> Limit -> IO TableType #

Create a TableType with the given element reference type and Limit.

withTableType :: ValType -> Limit -> (TableType -> IO a) -> IO a #

Scoped TableType.

getTableTypeRefType :: TableType -> IO ValType #

Get the reference type of a TableType.

Table instance

data TableInstance #

A runtime WebAssembly table instance.

getTableData :: TableInstance -> Word32 -> IO (WasmResult WasmVal) #

Get the reference value at an offset in the table.

setTableData :: TableInstance -> Word32 -> WasmVal -> IO (WasmResult ()) #

Set the reference value at an offset in the table.

getTableSize :: TableInstance -> IO Word32 #

Get the current element count of a table.

growTable :: TableInstance -> Word32 -> IO (WasmResult ()) #

Grow the table by count elements.

Internal / borrowed pointers

unsafeTablePtr :: TableInstance -> IO (Ptr TableInstanceTag) #

Extract the raw pointer of a TableInstance.

borrowTable :: Ptr TableInstanceTag -> IO TableInstance #

Create a borrowed TableInstance from a raw pointer (does not finalize).

unsafeTableTypePtr :: TableType -> IO (Ptr TableTypeTag) #

Extract the raw pointer of a TableType.

borrowTableType :: Ptr TableTypeTag -> IO TableType #

Create a borrowed TableType from a raw pointer (does not finalize).

disarmTable :: TableInstance -> IO () #

Disarm finalizer when ownership is transferred to a module instance.