| 16 | namespace wasmtime { |
| 17 | |
| 18 | inline Result<StructRef> StructRef::create(Store::Context cx, |
| 19 | const StructRefPre &pre, |
| 20 | const std::vector<Val> &fields) { |
| 21 | wasmtime_structref_t out; |
| 22 | auto *err = wasmtime_structref_new( |
| 23 | cx.capi(), pre.capi(), |
| 24 | reinterpret_cast<const wasmtime_val_t *>(fields.data()), fields.size(), |
| 25 | &out); |
| 26 | if (err) |
| 27 | return Result<StructRef>(Error(err)); |
| 28 | return Result<StructRef>(StructRef(out)); |
| 29 | } |
| 30 | |
| 31 | inline Result<Val> StructRef::field(Store::Context cx, size_t index) const { |
| 32 | wasmtime_val_t out; |