* \brief Creates a new host-defined table. * * \param cx the store in which to create the table. * \param ty the type of the table to be created * \param init the initial value for all table slots. * * Returns an error if `init` has the wrong value for the `ty` specified. */
| 46 | * Returns an error if `init` has the wrong value for the `ty` specified. |
| 47 | */ |
| 48 | static Result<Table> create(Store::Context cx, const TableType &ty, |
| 49 | const Val &init) { |
| 50 | wasmtime_table_t table; |
| 51 | auto *error = wasmtime_table_new(cx.ptr, ty.ptr.get(), &init.val, &table); |
| 52 | if (error != nullptr) { |
| 53 | return Error(error); |
| 54 | } |
| 55 | return Table(table); |
| 56 | } |
| 57 | |
| 58 | /// Returns the type of this table. |
| 59 | TableType type(Store::Context cx) const { |
nothing calls this directly
no test coverage detected