| Copyright | (c) 2026 Tushar Adhatrao |
|---|---|
| License | MIT |
| Stability | stable |
| Safe Haskell | None |
| Language | GHC2021 |
WasmEdge.Table
Description
Provides types and functions for WebAssembly table instances and types:
TableType— describes reference type and element limitsTableInstance— a runtime table instance
Synopsis
- data TableType
- createTableType :: ValType -> Limit -> IO TableType
- deleteTableType :: TableType -> IO ()
- withTableType :: ValType -> Limit -> (TableType -> IO a) -> IO a
- getTableTypeRefType :: TableType -> IO ValType
- getTableTypeLimit :: TableType -> IO Limit
- data TableInstance
- createTable :: TableType -> IO TableInstance
- deleteTable :: TableInstance -> IO ()
- withTable :: TableType -> (TableInstance -> IO a) -> IO a
- getTableType :: TableInstance -> IO TableType
- getTableData :: TableInstance -> Word32 -> IO (WasmResult WasmVal)
- setTableData :: TableInstance -> Word32 -> WasmVal -> IO (WasmResult ())
- getTableSize :: TableInstance -> IO Word32
- growTable :: TableInstance -> Word32 -> IO (WasmResult ())
- unsafeTablePtr :: TableInstance -> IO (Ptr TableInstanceTag)
- borrowTable :: Ptr TableInstanceTag -> IO TableInstance
- unsafeTableTypePtr :: TableType -> IO (Ptr TableTypeTag)
- borrowTableType :: Ptr TableTypeTag -> IO TableType
- disarmTable :: TableInstance -> IO ()
Table type
A WebAssembly table type, specifying the reference type (FuncRef or ExternRef) and element limits.
deleteTableType :: TableType -> IO () #
Delete a TableType.
Table instance
data TableInstance #
A runtime WebAssembly table instance.
createTable :: TableType -> IO TableInstance #
Create a TableInstance from a TableType.
deleteTable :: TableInstance -> IO () #
Delete a TableInstance.
withTable :: TableType -> (TableInstance -> IO a) -> IO a #
Scoped TableInstance.
getTableType :: TableInstance -> IO TableType #
Get the TableType of a TableInstance.
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.