|
Wasmtime
|
#include <wasm.h>#include <wasmtime/component/types/component.h>#include <wasmtime/conf.h>#include <wasmtime/error.h>Go to the source code of this file.
Typedefs | |
| typedef struct wasmtime_component_t | wasmtime_component_t |
| Representation of a component in the component model. | |
| typedef struct wasmtime_component_export_index_t | wasmtime_component_export_index_t |
| A value which represents a known export of a component. | |
Functions | |
| 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. More... | |
| 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. More... | |
| 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. More... | |
| 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. More... | |
| WASM_API_EXTERN wasmtime_component_t * | wasmtime_component_clone (const wasmtime_component_t *component) |
| Creates a shallow clone of the specified component, increasing the internal reference count. | |
| WASM_API_EXTERN wasmtime_component_type_t * | wasmtime_component_type (const wasmtime_component_t *component) |
| Returns the type of this component. More... | |
| WASM_API_EXTERN void | wasmtime_component_delete (wasmtime_component_t *component) |
| Deletes a wasmtime_component_t created by wasmtime_component_new. More... | |
| 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. More... | |
| WASM_API_EXTERN wasmtime_component_export_index_t * | wasmtime_component_export_index_clone (const wasmtime_component_export_index_t *index) |
| Creates a new separately-owned copy of the specified index. | |
| WASM_API_EXTERN void | wasmtime_component_export_index_delete (wasmtime_component_export_index_t *export_index) |
| Deletes a wasmtime_component_export_index_t. More... | |
| WASM_API_EXTERN void wasmtime_component_delete | ( | wasmtime_component_t * | component | ) |
Deletes a wasmtime_component_t created by wasmtime_component_new.
| component | the component to delete |
| 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.
This function does not take ownership of any of its arguments, but the returned error and component are owned by the caller.
This function is not safe to receive arbitrary user input. See the Rust documentation for more information on what inputs are safe to pass in here (e.g. only that of wasmtime_component_serialize)
| 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.
This function is the same as wasmtime_component_deserialize except that it reads the data for the serialized component from the path on disk. This can be faster than the alternative which may require copying the data around.
This function does not take ownership of any of its arguments, but the returned error and component are owned by the caller.
This function is not safe to receive arbitrary user input. See the Rust documentation for more information on what inputs are safe to pass in here (e.g. only that of wasmtime_component_serialize)
| WASM_API_EXTERN void wasmtime_component_export_index_delete | ( | wasmtime_component_export_index_t * | export_index | ) |
Deletes a wasmtime_component_export_index_t.
| export_index | the export index to delete |
| 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.
| component | the component to look up name in |
| instance_export_index | optional (i.e. nullable) instance to look up in |
| name | the name of the export |
| name_len | length of name in bytes |
| 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.
This function will compile a WebAssembly binary into an owned wasmtime_component_t.
It requires a component binary, such as what is produced by Rust cargo component tooling.
This function does not take ownership of any of its arguments, but the returned error and component are owned by the caller.
| engine | the wasm_engine_t that will create the component |
| buf | the address of the buffer containing the WebAssembly binary |
| len | the length of the buffer containing the WebAssembly binary |
| component_out | on success, contains the address of the created component |
| 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.
| component | the component |
| ret | if the conversion is successful, this byte vector is filled in with the serialized compiled component. |
NULL. If parsing fails then ret isn't touched.This function does not take ownership of component, and the caller is expected to deallocate the returned wasmtime_error_t and wasm_byte_vec_t.
| WASM_API_EXTERN wasmtime_component_type_t * wasmtime_component_type | ( | const wasmtime_component_t * | component | ) |
Returns the type of this component.
The returned pointer must be deallocatd with wasmtime_component_type_delete.