Crate wasmtime_c_api

Source
Expand description

This crate is the implementation of Wasmtime’s C API.

This crate is normally not intended to be used from Rust itself. For that, see the wasmtime crate. It is possible to use this crate via Cargo, for Rust crates that wrap C libraries that use wasmtime. Most often, this crate is compiled as a cdylib or staticlib, via the wasmtime-c-api crate.

Documentation for this crate largely lives in the header files of the include directory for this crate.

At a high level this crate implements the wasm.h API with some gymnastics, but otherwise an accompanying wasmtime.h API is provided which is more specific to Wasmtime and has fewer gymnastics to implement.

Re-exports§

pub use wasmtime;

Structs§

ForeignData
Helper for running a C-defined finalizer over some data when the Rust structure is dropped.
WasmStoreRef
This representation of a Store is used to implement the wasm.h API (and not the wasmtime.h API!)
WasmtimeStoreData
wasm_byte_vec_t
wasm_config_t
wasm_engine_t
wasm_exporttype_t
wasm_exporttype_vec_t
wasm_extern_t
wasm_extern_vec_t
wasm_externtype_t
wasm_externtype_vec_t
wasm_foreign_t
wasm_frame_t
wasm_frame_vec_t
wasm_func_t
wasm_functype_t
wasm_functype_vec_t
wasm_global_t
wasm_globaltype_t
wasm_globaltype_vec_t
wasm_importtype_t
wasm_importtype_vec_t
wasm_instance_t
wasm_limits_t
wasm_memory_t
wasm_memorytype_t
wasm_memorytype_vec_t
wasm_module_t
wasm_ref_t
*mut wasm_ref_t is a reference type (externref or funcref), as seen by the C API. Because we do not have a uniform representation for funcrefs and externrefs, a *mut wasm_ref_t is morally a Option<Box<Either<ExternRef, Func>>>.
wasm_shared_module_t
wasm_store_t
wasm_table_t
wasm_tabletype_t
wasm_tabletype_vec_t
wasm_trap_t
wasm_val_t
wasm_val_vec_t
wasm_valtype_t
wasm_valtype_vec_t
wasmtime_anyref_t
wasmtime_caller_t
wasmtime_error_t
wasmtime_extern_t
wasmtime_externref_t
wasmtime_instance_pre_t
wasmtime_linear_memory_t
wasmtime_linker_t
wasmtime_memory_creator_t
wasmtime_module_t
wasmtime_store_t
Representation of a Store for wasmtime.h This notably tries to move more burden of aliasing on the caller rather than internally, allowing for a more raw representation of contexts and such that requires less unsafe in the implementation.
wasmtime_val_t

Enums§

wasmtime_opt_level_t
wasmtime_profiling_strategy_t
wasmtime_strategy_t

Constants§

WASMTIME_ANYREF
WASMTIME_EXTERNREF
WASMTIME_EXTERN_FUNC
WASMTIME_EXTERN_GLOBAL
WASMTIME_EXTERN_MEMORY
WASMTIME_EXTERN_SHAREDMEMORY
WASMTIME_EXTERN_TABLE
WASMTIME_F32
WASMTIME_F64
WASMTIME_FUNCREF
WASMTIME_I32
WASMTIME_I64
WASMTIME_UPDATE_DEADLINE_CONTINUE
WASMTIME_UPDATE_DEADLINE_YIELD
WASMTIME_V128
WASM_CONST
WASM_EXTERNREF
WASM_EXTERN_FUNC
WASM_EXTERN_GLOBAL
WASM_EXTERN_MEMORY
WASM_EXTERN_TABLE
WASM_F32
WASM_F64
WASM_FUNCREF
WASM_I32
WASM_I64
WASM_VAR

Functions§

wasm_byte_vec_copy
wasm_byte_vec_delete
wasm_byte_vec_new
wasm_byte_vec_new_empty
wasm_byte_vec_new_uninitialized
wasm_config_delete
Deletes the wasm_config_t.
wasm_config_new
wasm_engine_delete
Deletes the wasm_engine_t.
wasm_engine_new
wasm_engine_new_with_config
wasm_exporttype_copy
Creates a new wasm_exporttype_t which matches the provided one.
wasm_exporttype_delete
Deletes the wasm_exporttype_t.
wasm_exporttype_name
wasm_exporttype_new
wasm_exporttype_type
wasm_exporttype_vec_copy
wasm_exporttype_vec_delete
wasm_exporttype_vec_new
wasm_exporttype_vec_new_empty
wasm_exporttype_vec_new_uninitialized
wasm_extern_as_func
wasm_extern_as_func_const
wasm_extern_as_global
wasm_extern_as_global_const
wasm_extern_as_memory
wasm_extern_as_memory_const
wasm_extern_as_ref
Returns the wasm_extern_t as mutable reference.
wasm_extern_as_ref_const
Returns the wasm_extern_t as immutable reference.
wasm_extern_as_table
wasm_extern_as_table_const
wasm_extern_copy
Creates a new wasm_extern_t which matches the provided one.
wasm_extern_delete
Deletes the wasm_extern_t.
wasm_extern_get_host_info
Returns the host information of the wasm_extern_t.
wasm_extern_kind
wasm_extern_same
Returns true if the given references are pointing to the same wasm_extern_t.
wasm_extern_set_host_info
Sets the host information of the wasm_extern_t.
wasm_extern_set_host_info_with_finalizer
Sets the host information finalizer of the wasm_extern_t.
wasm_extern_type
wasm_extern_vec_copy
wasm_extern_vec_delete
wasm_extern_vec_new
wasm_extern_vec_new_empty
wasm_extern_vec_new_uninitialized
wasm_externtype_as_functype
wasm_externtype_as_functype_const
wasm_externtype_as_globaltype
wasm_externtype_as_globaltype_const
wasm_externtype_as_memorytype
wasm_externtype_as_memorytype_const
wasm_externtype_as_tabletype
wasm_externtype_as_tabletype_const
wasm_externtype_copy
Creates a new wasm_externtype_t which matches the provided one.
wasm_externtype_delete
Deletes the wasm_externtype_t.
wasm_externtype_kind
wasm_externtype_vec_copy
wasm_externtype_vec_delete
wasm_externtype_vec_new
wasm_externtype_vec_new_empty
wasm_externtype_vec_new_uninitialized
wasm_foreign_as_ref
Returns the wasm_foreign_t as mutable reference.
wasm_foreign_as_ref_const
Returns the wasm_foreign_t as immutable reference.
wasm_foreign_copy
Creates a new wasm_foreign_t which matches the provided one.
wasm_foreign_delete
Deletes the wasm_foreign_t.
wasm_foreign_get_host_info
Returns the host information of the wasm_foreign_t.
wasm_foreign_new
wasm_foreign_same
Returns true if the given references are pointing to the same wasm_foreign_t.
wasm_foreign_set_host_info
Sets the host information of the wasm_foreign_t.
wasm_foreign_set_host_info_with_finalizer
Sets the host information finalizer of the wasm_foreign_t.
wasm_frame_copy
wasm_frame_delete
Deletes the wasm_frame_t.
wasm_frame_func_index
wasm_frame_func_offset
wasm_frame_instance
wasm_frame_module_offset
wasm_frame_vec_copy
wasm_frame_vec_delete
wasm_frame_vec_new
wasm_frame_vec_new_empty
wasm_frame_vec_new_uninitialized
wasm_func_as_extern
wasm_func_as_extern_const
wasm_func_as_ref
Returns the wasm_func_t as mutable reference.
wasm_func_as_ref_const
Returns the wasm_func_t as immutable reference.
wasm_func_call
wasm_func_copy
Creates a new wasm_func_t which matches the provided one.
wasm_func_delete
Deletes the wasm_func_t.
wasm_func_get_host_info
Returns the host information of the wasm_func_t.
wasm_func_new
wasm_func_new_with_env
wasm_func_param_arity
wasm_func_result_arity
wasm_func_same
Returns true if the given references are pointing to the same wasm_func_t.
wasm_func_set_host_info
Sets the host information of the wasm_func_t.
wasm_func_set_host_info_with_finalizer
Sets the host information finalizer of the wasm_func_t.
wasm_func_type
wasm_functype_as_externtype
wasm_functype_as_externtype_const
wasm_functype_copy
Creates a new wasm_functype_t which matches the provided one.
wasm_functype_delete
Deletes the wasm_functype_t.
wasm_functype_new
wasm_functype_params
wasm_functype_results
wasm_functype_vec_copy
wasm_functype_vec_delete
wasm_functype_vec_new
wasm_functype_vec_new_empty
wasm_functype_vec_new_uninitialized
wasm_global_as_extern
wasm_global_as_extern_const
wasm_global_as_ref
Returns the wasm_global_t as mutable reference.
wasm_global_as_ref_const
Returns the wasm_global_t as immutable reference.
wasm_global_copy
Creates a new wasm_global_t which matches the provided one.
wasm_global_delete
Deletes the wasm_global_t.
wasm_global_get
wasm_global_get_host_info
Returns the host information of the wasm_global_t.
wasm_global_new
wasm_global_same
Returns true if the given references are pointing to the same wasm_global_t.
wasm_global_set
wasm_global_set_host_info
Sets the host information of the wasm_global_t.
wasm_global_set_host_info_with_finalizer
Sets the host information finalizer of the wasm_global_t.
wasm_global_type
wasm_globaltype_as_externtype
wasm_globaltype_as_externtype_const
wasm_globaltype_content
wasm_globaltype_copy
Creates a new wasm_globaltype_t which matches the provided one.
wasm_globaltype_delete
Deletes the wasm_globaltype_t.
wasm_globaltype_mutability
wasm_globaltype_new
wasm_globaltype_vec_copy
wasm_globaltype_vec_delete
wasm_globaltype_vec_new
wasm_globaltype_vec_new_empty
wasm_globaltype_vec_new_uninitialized
wasm_importtype_copy
Creates a new wasm_importtype_t which matches the provided one.
wasm_importtype_delete
Deletes the wasm_importtype_t.
wasm_importtype_module
wasm_importtype_name
wasm_importtype_new
wasm_importtype_type
wasm_importtype_vec_copy
wasm_importtype_vec_delete
wasm_importtype_vec_new
wasm_importtype_vec_new_empty
wasm_importtype_vec_new_uninitialized
wasm_instance_as_ref
Returns the wasm_instance_t as mutable reference.
wasm_instance_as_ref_const
Returns the wasm_instance_t as immutable reference.
wasm_instance_copy
Creates a new wasm_instance_t which matches the provided one.
wasm_instance_delete
Deletes the wasm_instance_t.
wasm_instance_exports
wasm_instance_get_host_info
Returns the host information of the wasm_instance_t.
wasm_instance_new
wasm_instance_same
Returns true if the given references are pointing to the same wasm_instance_t.
wasm_instance_set_host_info
Sets the host information of the wasm_instance_t.
wasm_instance_set_host_info_with_finalizer
Sets the host information finalizer of the wasm_instance_t.
wasm_memory_as_extern
wasm_memory_as_extern_const
wasm_memory_as_ref
Returns the wasm_memory_t as mutable reference.
wasm_memory_as_ref_const
Returns the wasm_memory_t as immutable reference.
wasm_memory_copy
Creates a new wasm_memory_t which matches the provided one.
wasm_memory_data
wasm_memory_data_size
wasm_memory_delete
Deletes the wasm_memory_t.
wasm_memory_get_host_info
Returns the host information of the wasm_memory_t.
wasm_memory_grow
wasm_memory_new
wasm_memory_same
Returns true if the given references are pointing to the same wasm_memory_t.
wasm_memory_set_host_info
Sets the host information of the wasm_memory_t.
wasm_memory_set_host_info_with_finalizer
Sets the host information finalizer of the wasm_memory_t.
wasm_memory_size
wasm_memory_type
wasm_memorytype_as_externtype
wasm_memorytype_as_externtype_const
wasm_memorytype_copy
Creates a new wasm_memorytype_t which matches the provided one.
wasm_memorytype_delete
Deletes the wasm_memorytype_t.
wasm_memorytype_limits
wasm_memorytype_new
wasm_memorytype_vec_copy
wasm_memorytype_vec_delete
wasm_memorytype_vec_new
wasm_memorytype_vec_new_empty
wasm_memorytype_vec_new_uninitialized
wasm_module_as_ref
Returns the wasm_module_t as mutable reference.
wasm_module_as_ref_const
Returns the wasm_module_t as immutable reference.
wasm_module_copy
Creates a new wasm_module_t which matches the provided one.
wasm_module_delete
Deletes the wasm_module_t.
wasm_module_deserialize
wasm_module_exports
wasm_module_get_host_info
Returns the host information of the wasm_module_t.
wasm_module_imports
wasm_module_obtain
wasm_module_same
Returns true if the given references are pointing to the same wasm_module_t.
wasm_module_set_host_info
Sets the host information of the wasm_module_t.
wasm_module_set_host_info_with_finalizer
Sets the host information finalizer of the wasm_module_t.
wasm_module_share
wasm_ref_as_extern
wasm_ref_as_extern_const
wasm_ref_as_foreign
wasm_ref_as_foreign_const
wasm_ref_as_func
wasm_ref_as_func_const
wasm_ref_as_global
wasm_ref_as_global_const
wasm_ref_as_instance
wasm_ref_as_instance_const
wasm_ref_as_memory
wasm_ref_as_memory_const
wasm_ref_as_module
wasm_ref_as_module_const
wasm_ref_as_table
wasm_ref_as_table_const
wasm_ref_as_trap
wasm_ref_as_trap_const
wasm_ref_copy
wasm_ref_delete
Deletes the wasm_ref_t.
wasm_ref_get_host_info
wasm_ref_same
wasm_ref_set_host_info
wasm_ref_set_host_info_with_finalizer
wasm_shared_module_delete
Deletes the wasm_shared_module_t.
wasm_store_delete
Deletes the wasm_store_t.
wasm_store_new
wasm_table_as_extern
wasm_table_as_extern_const
wasm_table_as_ref
Returns the wasm_table_t as mutable reference.
wasm_table_as_ref_const
Returns the wasm_table_t as immutable reference.
wasm_table_copy
Creates a new wasm_table_t which matches the provided one.
wasm_table_delete
Deletes the wasm_table_t.
wasm_table_get
wasm_table_get_host_info
Returns the host information of the wasm_table_t.
wasm_table_grow
wasm_table_new
wasm_table_same
Returns true if the given references are pointing to the same wasm_table_t.
wasm_table_set
wasm_table_set_host_info
Sets the host information of the wasm_table_t.
wasm_table_set_host_info_with_finalizer
Sets the host information finalizer of the wasm_table_t.
wasm_table_size
wasm_table_type
wasm_tabletype_as_externtype
wasm_tabletype_as_externtype_const
wasm_tabletype_copy
Creates a new wasm_tabletype_t which matches the provided one.
wasm_tabletype_delete
Deletes the wasm_tabletype_t.
wasm_tabletype_element
wasm_tabletype_limits
wasm_tabletype_new
wasm_tabletype_vec_copy
wasm_tabletype_vec_delete
wasm_tabletype_vec_new
wasm_tabletype_vec_new_empty
wasm_tabletype_vec_new_uninitialized
wasm_trap_as_ref
Returns the wasm_trap_t as mutable reference.
wasm_trap_as_ref_const
Returns the wasm_trap_t as immutable reference.
wasm_trap_copy
Creates a new wasm_trap_t which matches the provided one.
wasm_trap_delete
Deletes the wasm_trap_t.
wasm_trap_get_host_info
Returns the host information of the wasm_trap_t.
wasm_trap_message
wasm_trap_new
wasm_trap_origin
wasm_trap_same
Returns true if the given references are pointing to the same wasm_trap_t.
wasm_trap_set_host_info
Sets the host information of the wasm_trap_t.
wasm_trap_set_host_info_with_finalizer
Sets the host information finalizer of the wasm_trap_t.
wasm_trap_trace
wasm_val_copy
wasm_val_delete
wasm_val_vec_copy
wasm_val_vec_delete
wasm_val_vec_new
wasm_val_vec_new_empty
wasm_val_vec_new_uninitialized
wasm_valtype_copy
Creates a new wasm_valtype_t which matches the provided one.
wasm_valtype_delete
Deletes the wasm_valtype_t.
wasm_valtype_kind
wasm_valtype_new
wasm_valtype_vec_copy
wasm_valtype_vec_delete
wasm_valtype_vec_new
wasm_valtype_vec_new_empty
wasm_valtype_vec_new_uninitialized
wasmtime_anyref_clone
wasmtime_anyref_from_i31
wasmtime_anyref_from_raw
wasmtime_anyref_i31_get_s
wasmtime_anyref_i31_get_u
wasmtime_anyref_to_raw
wasmtime_anyref_unroot
wasmtime_caller_context
wasmtime_caller_export_get
wasmtime_config_consume_fuel_set
wasmtime_config_debug_info_set
wasmtime_config_epoch_interruption_set
wasmtime_config_host_memory_creator_set
wasmtime_config_macos_use_mach_ports_set
wasmtime_config_max_wasm_stack_set
wasmtime_config_memory_guard_size_set
wasmtime_config_memory_init_cow_set
wasmtime_config_memory_may_move_set
wasmtime_config_memory_reservation_for_growth_set
wasmtime_config_memory_reservation_set
wasmtime_config_native_unwind_info_set
wasmtime_config_profiler_set
wasmtime_config_target_set
wasmtime_config_wasm_bulk_memory_set
wasmtime_config_wasm_function_references_set
wasmtime_config_wasm_gc_set
wasmtime_config_wasm_memory64_set
wasmtime_config_wasm_multi_memory_set
wasmtime_config_wasm_multi_value_set
wasmtime_config_wasm_reference_types_set
wasmtime_config_wasm_relaxed_simd_deterministic_set
wasmtime_config_wasm_relaxed_simd_set
wasmtime_config_wasm_simd_set
wasmtime_config_wasm_tail_call_set
wasmtime_config_wasm_wide_arithmetic_set
wasmtime_context_gc
wasmtime_context_get_data
wasmtime_context_get_fuel
wasmtime_context_set_data
wasmtime_context_set_epoch_deadline
wasmtime_context_set_fuel
wasmtime_engine_clone
wasmtime_engine_increment_epoch
wasmtime_engine_is_pulley
wasmtime_error_delete
Deletes the wasmtime_error_t.
wasmtime_error_exit_status
wasmtime_error_message
wasmtime_error_new
wasmtime_error_wasm_trace
wasmtime_extern_delete
wasmtime_extern_type
wasmtime_externref_clone
wasmtime_externref_data
wasmtime_externref_from_raw
wasmtime_externref_new
wasmtime_externref_to_raw
wasmtime_externref_unroot
wasmtime_frame_func_name
wasmtime_frame_module_name
wasmtime_func_call
wasmtime_func_call_unchecked
wasmtime_func_from_raw
wasmtime_func_new
wasmtime_func_new_unchecked
wasmtime_func_to_raw
wasmtime_func_type
wasmtime_global_get
wasmtime_global_new
wasmtime_global_set
wasmtime_global_type
wasmtime_instance_export_get
wasmtime_instance_export_nth
wasmtime_instance_new
wasmtime_instance_pre_delete
wasmtime_instance_pre_instantiate
wasmtime_instance_pre_module
wasmtime_linker_allow_shadowing
wasmtime_linker_clone
wasmtime_linker_define
wasmtime_linker_define_func
wasmtime_linker_define_func_unchecked
wasmtime_linker_define_instance
wasmtime_linker_delete
Deletes the wasmtime_linker_t.
wasmtime_linker_get
wasmtime_linker_get_default
wasmtime_linker_instantiate
wasmtime_linker_instantiate_pre
wasmtime_linker_module
wasmtime_linker_new
wasmtime_memory_data
wasmtime_memory_data_size
wasmtime_memory_grow
wasmtime_memory_new
wasmtime_memory_size
wasmtime_memory_type
wasmtime_memorytype_is64
wasmtime_memorytype_isshared
wasmtime_memorytype_maximum
wasmtime_memorytype_minimum
wasmtime_memorytype_new
wasmtime_module_clone
wasmtime_module_delete
Deletes the wasmtime_module_t.
wasmtime_module_deserialize
wasmtime_module_deserialize_file
wasmtime_module_exports
wasmtime_module_image_range
wasmtime_module_imports
wasmtime_store_context
wasmtime_store_delete
Deletes the wasmtime_store_t.
wasmtime_store_epoch_deadline_callback
wasmtime_store_limiter
wasmtime_store_new
wasmtime_table_get
wasmtime_table_grow
wasmtime_table_new
wasmtime_table_set
wasmtime_table_size
wasmtime_table_type
wasmtime_trap_code
wasmtime_trap_new
wasmtime_val_clone
wasmtime_val_unroot

Type Aliases§

WasmStore
WasmStoreContext
WasmStoreContextMut
WasmStoreData
WasmtimeCaller
WasmtimeStore
WasmtimeStoreContext
WasmtimeStoreContextMut
wasm_externkind_t
wasm_func_callback_t
wasm_func_callback_with_env_t
wasm_memory_pages_t
wasm_message_t
wasm_mutability_t
wasm_name_t
wasm_table_size_t
wasm_valkind_t
wasmtime_extern_kind_t
wasmtime_func_callback_t
wasmtime_func_unchecked_callback_t
wasmtime_memory_get_callback_t
wasmtime_memory_grow_callback_t
wasmtime_new_memory_callback_t
wasmtime_update_deadline_kind_t
wasmtime_valkind_t

Unions§

wasm_val_union
wasmtime_extern_union
wasmtime_func_t
wasmtime_val_union