Wasmtime
wasmtime::EqRef Class Reference

Representation of a WebAssembly eqref value. More...

#include <_eqref_class.hh>

Public Member Functions

bool is_i31 (Store::Context cx) const
 Returns true if this eqref is an i31ref.
 
std::optional< uint32_t > i31_get_u (Store::Context cx) const
 
std::optional< int32_t > i31_get_s (Store::Context cx) const
 
bool is_struct (Store::Context cx) const
 Returns true if this eqref is a structref.
 
bool is_array (Store::Context cx) const
 Returns true if this eqref is an arrayref.
 
AnyRef to_anyref () const
 Upcast this eqref to an anyref.
 
std::optional< StructRefas_struct (Store::Context cx) const
 Downcast this eqref into a structref.
 
std::optional< ArrayRefas_array (Store::Context cx) const
 Downcast this eqref into an arrayref.
 

Static Public Member Functions

static EqRef from_i31 (Store::Context cx, uint32_t val)
 Create an eqref from an i31 value.
 

Detailed Description

Representation of a WebAssembly eqref value.

An eqref is a reference to a GC object that supports equality testing. Subtypes include structref, arrayref, and i31ref.

Like all GC references, EqRef values are rooted in a Store and must be unrooted (by destruction or move) to allow garbage collection.

Member Function Documentation

◆ i31_get_s()

std::optional< int32_t > wasmtime::EqRef::i31_get_s ( Store::Context  cx) const
inline

Get the i31 value as a signed 32-bit integer. Returns std::nullopt if this eqref is not an i31ref.

◆ i31_get_u()

std::optional< uint32_t > wasmtime::EqRef::i31_get_u ( Store::Context  cx) const
inline

Get the i31 value as an unsigned 32-bit integer. Returns std::nullopt if this eqref is not an i31ref.


The documentation for this class was generated from the following file: