#ifndef WASMTIME_STRUCTREF_CLASS_HH
#define WASMTIME_STRUCTREF_CLASS_HH
#include <wasmtime/conf.h>
#ifdef WASMTIME_FEATURE_GC
#include <wasmtime/_anyref_class.hh>
#include <wasmtime/_eqref_class.hh>
#include <wasmtime/_store_class.hh>
#include <wasmtime/helpers.hh>
#include <wasmtime/structref.h>
#include <wasmtime/types/structref.hh>
namespace wasmtime {
class Val;
class StructRefPre {
WASMTIME_OWN_WRAPPER(StructRefPre, wasmtime_struct_ref_pre)
static StructRefPre create(Store::Context cx, const StructType &ty) {
return StructRefPre(wasmtime_struct_ref_pre_new(cx.capi(), ty.capi()));
}
};
class StructRef {
WASMTIME_REF_WRAPPER(StructRef, wasmtime_structref);
static Result<StructRef> create(Store::Context cx, const StructRefPre &pre,
const std::vector<Val> &fields);
Result<Val> field(Store::Context cx, size_t index) const;
Result<std::monostate> set_field(Store::Context cx, size_t index,
const Val &value) const;
AnyRef to_anyref() const;
EqRef to_eqref() const;
};
}
#endif
#endif