5#ifndef WASMTIME_TYPES_TABLE_HH
6#define WASMTIME_TYPES_TABLE_HH
25 std::unique_ptr<wasm_tabletype_t, deleter> ptr;
45 std::optional<uint64_t>
max()
const {
71 std::optional<uint32_t> max = std::nullopt) {
74 limits.
max = max.value_or(wasm_limits_max_default);
77 return Error(
"invalid table type");
Errors coming from Wasmtime.
Definition: error.hh:26
Fallible result type used for Wasmtime.
Definition: error.hh:70
Definition: types/table.hh:30
Ref(const wasm_tabletype_t *ptr)
Creates a reference from the raw underlying C API representation.
Definition: types/table.hh:37
Ref(const TableType &ty)
Creates a reference to the provided TableType.
Definition: types/table.hh:39
std::optional< uint64_t > max() const
Returns the maximum size of this table type, in elements, if present.
Definition: types/table.hh:45
ValType::Ref element() const
Returns the type of value that is stored in this table.
Definition: types/table.hh:57
uint64_t min() const
Returns the minimum size of this table type, in elements.
Definition: types/table.hh:42
bool is_64() const
Returns whether or not this is a 64-bit table type.
Definition: types/table.hh:54
Type information about a WebAssembly table.
Definition: types/table.hh:18
TableType(const TableType &other)
Copies another table type into this one.
Definition: types/table.hh:84
TableType & operator=(TableType &&other)=default
Moves the table type resources from another type to this one.
TableType(Ref other)
Clones the given reference into a new table type.
Definition: types/table.hh:82
Ref * operator->()
Returns the underlying Ref, a non-owning reference pointing to this instance.
Definition: types/table.hh:100
TableType & operator=(const TableType &other)
Copies another table type into this one.
Definition: types/table.hh:87
static Result< TableType > create(ValType ty, uint32_t min, std::optional< uint32_t > max=std::nullopt)
Definition: types/table.hh:70
TableType(TableType &&other)=default
Moves the table type resources from another type to this one.
Ref * operator*()
Returns the underlying Ref, a non-owning reference pointing to this instance.
Definition: types/table.hh:103
A WebAssembly table.
Definition: table.hh:31
Non-owning reference to a ValType, must not be used after the original ValType is deleted.
Definition: types/_val_class.hh:32
Type information about a WebAssembly value.
Definition: types/_val_class.hh:19
Limits for tables/memories in wasm modules.
Definition: wasm.h:164
uint32_t min
Definition: wasm.h:165
uint32_t max
Definition: wasm.h:166
An opaque object representing the type of a table.
WASM_API_EXTERN uint64_t wasmtime_tabletype_minimum(const wasm_tabletype_t *ty)
Returns the minimum size, in elements, of the specified table type.
WASM_API_EXTERN bool wasmtime_tabletype_maximum(const wasm_tabletype_t *ty, uint64_t *max)
Returns the maximum size, in elements, of the specified table type.
WASM_API_EXTERN bool wasmtime_tabletype_is64(const wasm_tabletype_t *ty)
Returns whether this type of table represents a 64-bit table.
const wasm_valtype_t * wasm_tabletype_element(const wasm_tabletype_t *)
Returns the element type of this table.
wasm_tabletype_t * wasm_tabletype_new(wasm_valtype_t *, const wasm_limits_t *)
Creates a new table type.
wasm_tabletype_t * wasm_tabletype_copy(const wasm_tabletype_t *)
Creates a new value which matches the provided one.
void wasm_tabletype_delete(wasm_tabletype_t *)
Deletes a type.