Wasmtime
wasmtime::AnyRef Class Reference

Representation of a WebAssembly anyref value. More...

#include <val.hh>

Public Member Functions

 AnyRef (wasmtime_anyref_t val)
 Creates a new AnyRef directly from its C-API representation.
 
AnyRef clone (Store::Context cx)
 Creates a new AnyRef which is separately rooted from this one.
 
void unroot (Store::Context cx)
 
const wasmtime_anyref_traw () const
 
std::optional< uint32_t > u31 (Store::Context cx) const
 If this is an i31, get the value zero-extended.
 
std::optional< int32_t > i31 (Store::Context cx) const
 If this is an i31, get the value sign-extended.
 

Static Public Member Functions

static AnyRef i31 (Store::Context cx, uint32_t value)
 

Friends

class Val
 

Detailed Description

Representation of a WebAssembly anyref value.

Member Function Documentation

◆ i31()

static AnyRef wasmtime::AnyRef::i31 ( Store::Context  cx,
uint32_t  value 
)
inlinestatic

Creates a new AnyRef which is an i31 with the given value, truncated if the upper bit is set.

◆ raw()

const wasmtime_anyref_t * wasmtime::AnyRef::raw ( ) const
inline

Returns the raw underlying C API value.

This class still retains ownership of the pointer.

◆ unroot()

void wasmtime::AnyRef::unroot ( Store::Context  cx)
inline

Unroots this value from the context provided, enabling a future GC to collect the internal object if there are no more references.


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