Wasmtime
component/types/component.h File Reference

Go to the source code of this file.

Data Structures

union  wasmtime_component_item_union
 Represents a single item in a component's import or export list. More...
 
struct  wasmtime_component_item_t
 Represents a single item in a component's import or export list. More...
 

Macros

#define WASMTIME_COMPONENT_ITEM_COMPONENT   0
 Value of wasmtime_component_item_kind_t meaning that wasmtime_component_item_t is a component.
 
#define WASMTIME_COMPONENT_ITEM_COMPONENT_INSTANCE   1
 Value of wasmtime_component_item_kind_t meaning that wasmtime_component_item_t is a component instance.
 
#define WASMTIME_COMPONENT_ITEM_MODULE   2
 Value of wasmtime_component_item_kind_t meaning that wasmtime_component_item_t is a module.
 
#define WASMTIME_COMPONENT_ITEM_COMPONENT_FUNC   3
 Value of wasmtime_component_item_kind_t meaning that wasmtime_component_item_t is a component function.
 
#define WASMTIME_COMPONENT_ITEM_RESOURCE   4
 Value of wasmtime_component_item_kind_t meaning that wasmtime_component_item_t is a resource.
 
#define WASMTIME_COMPONENT_ITEM_CORE_FUNC   5
 Value of wasmtime_component_item_kind_t meaning that wasmtime_component_item_t is a core function.
 
#define WASMTIME_COMPONENT_ITEM_TYPE   6
 Value of wasmtime_component_item_kind_t meaning that wasmtime_component_item_t is a type.
 

Typedefs

typedef struct wasmtime_component_type_t wasmtime_component_type_t
 Represents the type of a WebAssembly component.
 
typedef uint8_t wasmtime_component_item_kind_t
 Discriminant used in wasmtime_component_item_t::kind.
 
typedef union wasmtime_component_item_union wasmtime_component_item_union_t
 Represents a single item in a component's import or export list.
 
typedef struct wasmtime_component_item_t wasmtime_component_item_t
 Represents a single item in a component's import or export list.
 

Functions

WASM_API_EXTERN wasmtime_component_type_twasmtime_component_type_clone (const wasmtime_component_type_t *ty)
 Clones a component type. More...
 
WASM_API_EXTERN void wasmtime_component_type_delete (wasmtime_component_type_t *ty)
 Deallocates a component type.
 
WASM_API_EXTERN size_t wasmtime_component_type_import_count (const wasmtime_component_type_t *ty, const wasm_engine_t *engine)
 Returns the number of imports of a component type.
 
WASM_API_EXTERN bool wasmtime_component_type_import_get (const wasmtime_component_type_t *ty, const wasm_engine_t *engine, const char *name, size_t name_len, struct wasmtime_component_item_t *ret)
 Retrieves the import with the specified name. More...
 
WASM_API_EXTERN bool wasmtime_component_type_import_nth (const wasmtime_component_type_t *ty, const wasm_engine_t *engine, size_t nth, const char **name_ret, size_t *name_len_ret, struct wasmtime_component_item_t *type_ret)
 Retrieves the nth import. More...
 
WASM_API_EXTERN size_t wasmtime_component_type_export_count (const wasmtime_component_type_t *ty, const wasm_engine_t *engine)
 Returns the number of exports of a component type.
 
WASM_API_EXTERN bool wasmtime_component_type_export_get (const wasmtime_component_type_t *ty, const wasm_engine_t *engine, const char *name, size_t name_len, struct wasmtime_component_item_t *ret)
 Retrieves the export with the specified name. More...
 
WASM_API_EXTERN bool wasmtime_component_type_export_nth (const wasmtime_component_type_t *ty, const wasm_engine_t *engine, size_t nth, const char **name_ret, size_t *name_len_ret, struct wasmtime_component_item_t *type_ret)
 Retrieves the nth export. More...
 
WASM_API_EXTERN void wasmtime_component_item_clone (const wasmtime_component_item_t *item, wasmtime_component_item_t *out)
 Clones a component item. More...
 
WASM_API_EXTERN void wasmtime_component_item_delete (wasmtime_component_item_t *ptr)
 Deallocates a component item.
 

Function Documentation

◆ wasmtime_component_item_clone()

WASM_API_EXTERN void wasmtime_component_item_clone ( const wasmtime_component_item_t item,
wasmtime_component_item_t out 
)

Clones a component item.

The returned pointer must be deallocated with wasmtime_component_item_delete.

◆ wasmtime_component_type_clone()

WASM_API_EXTERN wasmtime_component_type_t * wasmtime_component_type_clone ( const wasmtime_component_type_t ty)

Clones a component type.

The returned pointer must be deallocated wit hwasmtime_component_type_delete.

◆ wasmtime_component_type_export_get()

WASM_API_EXTERN bool wasmtime_component_type_export_get ( const wasmtime_component_type_t ty,
const wasm_engine_t engine,
const char *  name,
size_t  name_len,
struct wasmtime_component_item_t ret 
)

Retrieves the export with the specified name.

The returned wasmtime_component_item_t must be deallocated with wasmtime_component_item_delete.

◆ wasmtime_component_type_export_nth()

WASM_API_EXTERN bool wasmtime_component_type_export_nth ( const wasmtime_component_type_t ty,
const wasm_engine_t engine,
size_t  nth,
const char **  name_ret,
size_t *  name_len_ret,
struct wasmtime_component_item_t type_ret 
)

Retrieves the nth export.

The returned wasmtime_component_item_t must be deallocated with wasmtime_component_item_delete.

◆ wasmtime_component_type_import_get()

WASM_API_EXTERN bool wasmtime_component_type_import_get ( const wasmtime_component_type_t ty,
const wasm_engine_t engine,
const char *  name,
size_t  name_len,
struct wasmtime_component_item_t ret 
)

Retrieves the import with the specified name.

The returned wasmtime_component_item_t must be deallocated with wasmtime_component_item_delete.

◆ wasmtime_component_type_import_nth()

WASM_API_EXTERN bool wasmtime_component_type_import_nth ( const wasmtime_component_type_t ty,
const wasm_engine_t engine,
size_t  nth,
const char **  name_ret,
size_t *  name_len_ret,
struct wasmtime_component_item_t type_ret 
)

Retrieves the nth import.

The returned wasmtime_component_item_t must be deallocated with wasmtime_component_item_delete.