5#ifndef WASMTIME_TABLE_HH
6#define WASMTIME_TABLE_HH
52 if (error !=
nullptr) {
74 return std::optional(std::move(val));
83 const Val &val)
const {
85 if (error !=
nullptr) {
88 return std::monostate();
100 const Val &init)
const {
103 if (error !=
nullptr) {
Errors coming from Wasmtime.
Definition: error.hh:25
A WebAssembly instance.
Definition: instance.hh:31
Fallible result type used for Wasmtime.
Definition: error.hh:82
An interior pointer into a Store.
Definition: store.hh:60
Type information about a WebAssembly table.
Definition: types/table.hh:16
A WebAssembly table.
Definition: table.hh:31
Table(wasmtime_table_t table)
Creates a new table from the raw underlying C API representation.
Definition: table.hh:37
Result< std::monostate > set(Store::Context cx, uint64_t idx, const Val &val) const
Definition: table.hh:82
const wasmtime_table_t & capi() const
Returns the raw underlying C API table this is using.
Definition: table.hh:110
static Result< Table > create(Store::Context cx, const TableType &ty, const Val &init)
Creates a new host-defined table.
Definition: table.hh:48
Result< uint64_t > grow(Store::Context cx, uint64_t delta, const Val &init) const
Definition: table.hh:99
uint64_t size(Store::Context cx) const
Returns the size, in elements, that the table currently has.
Definition: table.hh:64
TableType type(Store::Context cx) const
Returns the type of this table.
Definition: table.hh:59
std::optional< Val > get(Store::Context cx, uint64_t idx) const
Definition: table.hh:71
Representation of a generic WebAssembly value.
Definition: val.hh:156
Representation of a table in Wasmtime.
Definition: extern.h:43
wasm_tabletype_t * wasmtime_table_type(const wasmtime_context_t *store, const wasmtime_table_t *table)
Returns the type of this table.
wasmtime_error_t * wasmtime_table_set(wasmtime_context_t *store, const wasmtime_table_t *table, uint64_t index, const wasmtime_val_t *value)
Sets a value in a table.
wasmtime_error_t * wasmtime_table_new(wasmtime_context_t *store, const wasm_tabletype_t *ty, const wasmtime_val_t *init, wasmtime_table_t *table)
Creates a new host-defined wasm table.
bool wasmtime_table_get(wasmtime_context_t *store, const wasmtime_table_t *table, uint64_t index, wasmtime_val_t *val)
Gets a value in a table.
wasmtime_error_t * wasmtime_table_grow(wasmtime_context_t *store, const wasmtime_table_t *table, uint64_t delta, const wasmtime_val_t *init, uint64_t *prev_size)
Grows a table.
uint64_t wasmtime_table_size(const wasmtime_context_t *store, const wasmtime_table_t *table)
Returns the size, in elements, of the specified table.