Wasmtime
tag.h File Reference

Wasmtime APIs for interacting with WebAssembly tags. More...

#include <wasm.h>
#include <wasmtime/error.h>
#include <wasmtime/store.h>

Go to the source code of this file.

Data Structures

struct  wasmtime_tag
 Representation of a tag in Wasmtime. More...
 

Macros

#define WASMTIME_EXTERN_TAG   5
 Value of wasmtime_extern_kind_t meaning that wasmtime_extern_t is a tag.
 

Typedefs

typedef struct wasmtime_tag wasmtime_tag_t
 Representation of a tag in Wasmtime. More...
 

Functions

WASM_API_EXTERN wasmtime_error_twasmtime_tag_new (wasmtime_context_t *store, const wasm_tagtype_t *tt, wasmtime_tag_t *ret)
 Creates a new host-defined tag. More...
 
WASM_API_EXTERN wasm_tagtype_twasmtime_tag_type (const wasmtime_context_t *store, const wasmtime_tag_t *tag)
 Returns the type of the given tag. More...
 
WASM_API_EXTERN bool wasmtime_tag_eq (const wasmtime_context_t *store, const wasmtime_tag_t *a, const wasmtime_tag_t *b)
 Tests whether two tags are identical (same definition).
 

Detailed Description

Wasmtime APIs for interacting with WebAssembly tags.

Tags are used to create and identify exception objects. A tag describes the signature (payload types) of exceptions created with it.

Typedef Documentation

◆ wasmtime_tag_t

typedef struct wasmtime_tag wasmtime_tag_t

Representation of a tag in Wasmtime.

Tags in Wasmtime are represented as an index into a store and don't have any data or destructor associated with the wasmtime_tag_t value. Tags cannot interoperate between wasmtime_store_t instances and if the wrong tag is passed to the wrong store then it may trigger an assertion to abort the process.

Function Documentation

◆ wasmtime_tag_new()

WASM_API_EXTERN wasmtime_error_t * wasmtime_tag_new ( wasmtime_context_t store,
const wasm_tagtype_t tt,
wasmtime_tag_t ret 
)

Creates a new host-defined tag.

Parameters
storethe store in which to create the tag
ttthe tag type that describes the tag's exception payload
reton success, filled with the new tag
Returns
NULL on success, otherwise an error describing the failure.

◆ wasmtime_tag_type()

WASM_API_EXTERN wasm_tagtype_t * wasmtime_tag_type ( const wasmtime_context_t store,
const wasmtime_tag_t tag 
)

Returns the type of the given tag.

The returned wasm_tagtype_t is owned by the caller.