5#ifndef WASMTIME_GLOBAL_HH
6#define WASMTIME_GLOBAL_HH
49 if (error !=
nullptr) {
64 return std::move(val);
72 if (error !=
nullptr) {
75 return std::monostate();
Errors coming from Wasmtime.
Definition: error.hh:25
Type information about a WebAssembly global.
Definition: types/global.hh:15
A WebAssembly global.
Definition: global.hh:28
Global(wasmtime_global_t global)
Creates as global from the raw underlying C API representation.
Definition: global.hh:34
const wasmtime_global_t & capi() const
Returns the raw underlying C API global this is using.
Definition: global.hh:79
Result< std::monostate > set(Store::Context cx, const Val &val) const
Definition: global.hh:70
Val get(Store::Context cx) const
Returns the current value of this global.
Definition: global.hh:61
GlobalType type(Store::Context cx) const
Returns the type of this global.
Definition: global.hh:56
static Result< Global > create(Store::Context cx, const GlobalType &ty, const Val &init)
Create a new WebAssembly global.
Definition: global.hh:45
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
Representation of a generic WebAssembly value.
Definition: val.hh:156
wasmtime_error_t * wasmtime_global_new(wasmtime_context_t *store, const wasm_globaltype_t *type, const wasmtime_val_t *val, wasmtime_global_t *ret)
Creates a new global value.
wasmtime_error_t * wasmtime_global_set(wasmtime_context_t *store, const wasmtime_global_t *global, const wasmtime_val_t *val)
Sets a global to a new value.
wasm_globaltype_t * wasmtime_global_type(const wasmtime_context_t *store, const wasmtime_global_t *global)
Returns the wasm type of the specified global.
void wasmtime_global_get(wasmtime_context_t *store, const wasmtime_global_t *global, wasmtime_val_t *out)
Get the value of the specified global.
Representation of a global in Wasmtime.
Definition: extern.h:71