5#ifndef WASMTIME_COMPONENT_COMPONENT_HH
6#define WASMTIME_COMPONENT_COMPONENT_HH
10#ifdef WASMTIME_FEATURE_COMPONENT_MODEL
33 WASMTIME_CLONE_WRAPPER(
ExportIndex, wasmtime_component_export_index);
40 WASMTIME_CLONE_WRAPPER(
Component, wasmtime_component);
42#ifdef WASMTIME_FEATURE_COMPILER
54 auto bytes = wasm.ok();
55 return compile(engine, bytes);
73 if (error !=
nullptr) {
96 if (error !=
nullptr) {
115 const std::string &path) {
119 if (error !=
nullptr) {
125#ifdef WASMTIME_FEATURE_COMPILER
135 if (error !=
nullptr) {
138 std::vector<uint8_t> ret;
153 std::optional<ExportIndex> export_index(
ExportIndex *instance,
154 std::string_view name) {
156 capi(), instance ? instance->capi() :
nullptr, name.data(),
Global compilation state in Wasmtime.
Definition: engine.hh:22
Errors coming from Wasmtime.
Definition: error.hh:26
Fallible result type used for Wasmtime.
Definition: error.hh:70
Span class used when c++20 is not available.
Definition: span.hh:47
std::size_t size() const
Returns number of data that referred by Span class.
Definition: span.hh:81
iterator end() const
Returns end iterator.
Definition: span.hh:87
T * data() const
Returns pointer to data.
Definition: span.hh:78
iterator begin() const
Returns begin iterator.
Definition: span.hh:84
Represents the type of a WebAssembly component.
Definition: component/types/component.hh:29
Representation of a compiled WebAssembly component.
Definition: component/component.hh:39
An index to an exported item within a particular component.
Definition: component/component.hh:32
WASM_API_EXTERN wasmtime_error_t * wasmtime_component_new(const wasm_engine_t *engine, const uint8_t *buf, size_t len, wasmtime_component_t **component_out)
Compiles a WebAssembly binary into a wasmtime_component_t.
WASM_API_EXTERN wasmtime_component_type_t * wasmtime_component_type(const wasmtime_component_t *component)
Returns the type of this component.
struct wasmtime_component_t wasmtime_component_t
Representation of a component in the component model.
Definition: component/component.h:18
WASM_API_EXTERN wasmtime_component_export_index_t * wasmtime_component_get_export_index(const wasmtime_component_t *component, const wasmtime_component_export_index_t *instance_export_index, const char *name, size_t name_len)
Looks up a specific export of this component by name optionally nested within the instance provided.
WASM_API_EXTERN wasmtime_error_t * wasmtime_component_deserialize_file(const wasm_engine_t *engine, const char *path, wasmtime_component_t **component_out)
Deserialize a component from an on-disk file.
WASM_API_EXTERN wasmtime_error_t * wasmtime_component_deserialize(const wasm_engine_t *engine, const uint8_t *buf, size_t len, wasmtime_component_t **component_out)
Build a component from serialized data.
WASM_API_EXTERN wasmtime_error_t * wasmtime_component_serialize(const wasmtime_component_t *component, wasm_byte_vec_t *ret)
This function serializes compiled component artifacts as blob data.
Build-time defines for how the C API was built.
A list of bytes.
Definition: wasm.h:102
size_t size
Length of this vector.
Definition: wasm.h:102
wasm_byte_t * data
Pointer to the base of this vector.
Definition: wasm.h:102
void wasm_byte_vec_delete(wasm_byte_vec_t *)
Deletes a byte vector.
Result< std::vector< uint8_t > > wat2wasm(std::string_view wat)
Converts the WebAssembly text format into the WebAssembly binary format.
Definition: wat.hh:30