Wasmtime
wasmtime::Exn Class Reference

A WebAssembly exception object. More...

#include <exn.hh>

Public Member Functions

 Exn (wasmtime_exn_t *raw)
 Takes ownership of a raw wasmtime_exn_t pointer.
 
 Exn (Exn &&other)=default
 Constructs a new exception.
 
Exnoperator= (Exn &&other)=default
 Moves an exception.
 
 Exn (const Exn &)=delete
 
Exnoperator= (const Exn &)=delete
 
 ~Exn ()=default
 Destroys an exception.
 
Result< Tagtag (Store::Context cx) const
 Returns the tag associated with this exception.
 
size_t field_count (Store::Context cx) const
 Returns the number of fields in this exception.
 
Result< Valfield (Store::Context cx, size_t index) const
 Reads a field value by index.
 
wasmtime_exn_tcapi () const
 Returns the raw underlying C API pointer (non-owning).
 
wasmtime_exn_trelease ()
 Releases ownership of the underlying C API pointer.
 

Static Public Member Functions

static Result< Exncreate (Store::Context cx, const Tag &tag, const std::vector< Val > &fields)
 Create a new exception object. More...
 

Detailed Description

A WebAssembly exception object.

Exception objects carry a tag and a set of field values. They are allocated on the GC heap within a store.

This type owns its underlying wasmtime_exn_t handle. When it goes out of scope the handle is freed.

Member Function Documentation

◆ create()

static Result< Exn > wasmtime::Exn::create ( Store::Context  cx,
const Tag tag,
const std::vector< Val > &  fields 
)
inlinestatic

Create a new exception object.

Parameters
cxthe store in which to allocate the exception
tagthe tag to associate with this exception
fieldsthe field values matching the tag's payload signature

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