5#ifndef WASMTIME_COMPONENT_TYPES_INSTANCE_HH
6#define WASMTIME_COMPONENT_TYPES_INSTANCE_HH
10#ifdef WASMTIME_FEATURE_COMPONENT_MODEL
17#include <wasmtime/helpers.hh>
29 wasmtime_component_instance_type);
32 size_t export_count(
const Engine &engine)
const {
37 std::optional<ComponentItem> export_get(
const Engine &engine,
38 std::string_view name)
const;
41 std::optional<std::pair<std::string_view, ComponentItem>>
42 export_nth(
const Engine &engine,
size_t nth)
const;
50inline std::optional<wasmtime::component::ComponentItem>
51wasmtime::component::ComponentInstanceType::export_get(
55 capi(), engine.capi(), name.data(), name.size(), &item);
63 std::pair<std::string_view, wasmtime::component::ComponentItem>>
64wasmtime::component::ComponentInstanceType::export_nth(
67 const char *name_data;
70 capi(), engine.capi(), nth, &name_data, &name_size, &item);
74 return std::make_pair(std::string_view(name_data, name_size),
Global compilation state in Wasmtime.
Definition: engine.hh:22
Represents the type of a component instance.
Definition: component/types/instance.hh:27
Represents a single item in a component's import or export list.
Definition: component/types/component.hh:68
WASM_API_EXTERN bool wasmtime_component_instance_type_export_get(const wasmtime_component_instance_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.
WASM_API_EXTERN bool wasmtime_component_instance_type_export_nth(const wasmtime_component_instance_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.
WASM_API_EXTERN size_t wasmtime_component_instance_type_export_count(const wasmtime_component_instance_type_t *ty, const wasm_engine_t *engine)
Returns the number of exports of a component instance type.
Build-time defines for how the C API was built.
Represents a single item in a component's import or export list.
Definition: component/types/component.h:137