Cargo Features
[dependencies]
wasmtime = { version = "30.0.0", default-features = false, features = ["cranelift", "winch", "pulley", "incremental-cache", "profiling", "parallel-compilation", "cache", "async", "pooling-allocator", "all-arch", "component-model", "wmemcheck", "trace-log", "demangle", "coredump", "debug-builtins", "runtime", "gc", "gc-drc", "gc-null", "threads", "addr2line", "std", "call-hook", "memory-protection-keys", "reexport-wasmparser", "wave", "custom-virtual-memory", "custom-native-signals", "profile-pulley", "component-model-async", "wat"] }
=============================================================================
Features for the Wasmtime crate.
This section contains the compile-time features of the
wasmtime
crate. These features can be used to add more functionality and APIs exposed from the crate's API. Most of them are enabled by default. Disabling features can be done to cut down on binary size by disabling features that are not required for a particular embedding.
- default = addr2line, async, cache, component-model, coredump, cranelift, debug-builtins, demangle, gc, gc-drc, gc-null, parallel-compilation, pooling-allocator, profiling, runtime, std, threads, wat
-
These default features are set whenever
wasmtime
is added without
somewhere in the dependency tree.default-features = false - cranelift default = std
-
An on-by-default feature enabling runtime compilation of WebAssembly modules with the Cranelift compiler. Cranelift is the default compilation backend of Wasmtime. If disabled then WebAssembly modules can only be created from precompiled WebAssembly modules.
Enables wasmtime-cranelift
Affects
serialization::append_compiler_info
… - winch = std
-
Enables support for Winch, the WebAssembly baseline compiler. The Winch compiler strategy in
Config
will be available. It is currently in active development and shouldn't be used in production applications.Enables wasmtime-winch
Affects
serialization::append_compiler_info
… - pulley all-arch? profile-pulley?
-
Enables support for Pulley, the WebAssembly interpreter. When paired with the
cranelift
feature, the compiler backends for thepulley32
andpulley64
targets will be available. When paired with theruntime
feature, the Pulley interpreter will be built into the runtime and you can interpret WebAssembly modules that have been compiled to Pulley bytecode.Affects
profiling_agent::ProfilingAgent.register_interpreter
… - incremental-cache = std
-
Enables support for incremental compilation cache to be enabled in
Config
.Enables incremental-cache of optional wasmtime-cranelift
- profiling default profile-pulley? = std
-
Enables support for profiling guest modules.
Enables fxprof-processed-profile ^0.6.0 and ittapi, serde_json and wasmtime-jit-debug, thread of rustix
- parallel-compilation default = std
-
Enables parallel compilation of WebAssembly code.
Enables rayon
- cache default = std
-
Enables support for automatic cache configuration to be enabled in
Config
.Enables wasmtime-cache
- async default component-model-async? = runtime
-
Enables support for "async stores" as well as defining host functions as
async fn
and calling functions asynchronously.Enables wasmtime-fiber, async-trait and trait-variant, async of optional wasmtime-component-macro
Affects
limits::ResourceLimiterAsync
,gc_runtime::collect_async
,pooling::InstanceLimits.total_stacks
,pooling::PoolingInstanceAllocatorConfig.async_stack_keep_resident
,allocator::InstanceAllocatorImpl.allocate_fiber_stack
,allocator::InstanceAllocatorImpl.deallocate_fiber_stack
,disabled::current_mask
,enabled::current_mask
,disabled::allow
,disabled::ProtectionMask
… - pooling-allocator default memory-protection-keys? = runtime, std
-
Enables support for the pooling instance allocation strategy
Affects
config::PoolingAllocationConfig
,gc_runtime::GcHeap.reset
,disabled::is_supported
,disabled::keys
,vm::commit_pages
,vm::decommit_pages
,vm::commit_pages
,vm::commit_pages
,vm::decommit_pages
,vm::commit_pages
,vm::decommit_pages
,disabled::allow
,disabled::ProtectionMask
… - all-arch = pulley
-
Enables support for all architectures in Cranelift, allowing cross-compilation using the
wasmtime
crate's API, notably theEngine::precompile_module
function.Enables all-arch of optional wasmtime-cranelift and optional wasmtime-winch
- component-model default component-model-async? wave?
-
Enables in-progress support for the component model. Note that this feature is in-progress, buggy, and incomplete. This is primarily here for internal testing purposes.
Enables encoding_rs, semver, wasmtime-component-macro, and wasmtime-component-util, component-model of wasmtime-environ, optional wasmtime-cranelift, and optional wasmtime-winch
Affects
allocator::InstanceAllocatorImpl.validate_component_impl
,allocator::InstanceAllocator.validate_component
,vm::component
,vm::VMStore.component_calls
,runtime::component
… - wmemcheck = std
-
Enables wasmtime-wmemcheck, wmemcheck of wasmtime-environ, optional wasmtime-cranelift, and optional wasmtime-winch
- trace-log
-
Enables detailed internal compiler logging via WASMTIME_LOG
Enables trace-log of optional wasmtime-cranelift
- demangle default = std
-
Enables support for demangling WebAssembly function names at runtime in errors such as backtraces.
Enables demangle of wasmtime-environ
- coredump default = runtime, std
-
Enable support for generating core dumps on traps.
Enables wasm-encoder ^0.224.0
- debug-builtins default = std
-
Export some symbols from the final binary to assist in debugging Cranelift-generated code with native debuggers like GDB and LLDB.
Enables wasmtime-jit-debug
Affects
vm::debug_builtins
… - runtime default async coredump pooling-allocator
-
Enable support for executing compiled Wasm modules.
Enables mach2, memfd, psm, and cc, smallvec, wasmtime-asm-macros, wasmtime-jit-icache-coherence, wasmtime-slab, wasmtime-versioned-export-macros, and windows-sys, interp of pulley-interpreter, mm of rustix
Affects
profiling_agent::ProfilingAgent.register_interpreter
… - gc default gc-drc gc-null
-
Enable support for garbage collection-related things.
This Cargo feature is required to compile or run Wasm that uses any of the following Wasm proposals:
- Reference types: https://github.com/WebAssembly/reference-types/
- Typed function references: https://github.com/WebAssembly/function-references/
- Garbage collection: https://github.com/WebAssembly/gc
When a compiler Cargo feature (
cranelift
orwinch
) is enabled, this feature gates the ability to compile Wasm that uses those proposals.When the
runtime
Cargo feature is enabled, this feature gates the ability to load and run Wasm that uses those proposals.You can additionally configure which GC implementations are enabled via the
gc-drc
andgc-null
features.Enables gc of optional wasmtime-cranelift, wasmtime-environ, and optional wasmtime-winch
Affects
gc_runtime::GcRuntime.new_gc_heap
,pooling::InstanceLimits.total_gc_heaps
,allocator::InstanceAllocatorImpl.allocate_gc_heap
,allocator::InstanceAllocatorImpl.deallocate_gc_heap
… - gc-drc default = gc
-
Enable the deferred reference counting garbage collector.
Enables gc-drc of optional wasmtime-cranelift, wasmtime-environ, and optional wasmtime-winch
- gc-null default = gc
-
Enable the null garbage collector.
Enables gc-null of optional wasmtime-cranelift, wasmtime-environ, and optional wasmtime-winch
- threads default = std
-
Enable runtime support for the WebAssembly threads proposal.
Enables threads of optional wasmtime-cranelift and optional wasmtime-winch
Affects
memory::validate_atomic_addr
… - addr2line default = std
-
Controls whether backtraces will attempt to parse DWARF information in WebAssembly modules and components to provide filenames and line numbers in stack traces.
Affects
instantiate::SymbolizeContext
… - std default addr2line cache component-model-async? coredump cranelift debug-builtins demangle incremental-cache? parallel-compilation pooling-allocator profiling threads winch? wmemcheck? = once_cell
-
Enables support for the Rust standard library, enabling APIs that require types and traits from Rust's
std
such asPath
andError
.Many features of the Wasmtime crate implicitly require this
std
feature. This will be automatically enabled if necessary.Enables use-std of postcard, std of object and optional addr2line, std of pulley-interpreter, wasmtime-environ, wasmtime-math, and optional wasmtime-fiber
Affects
serialization::detect_precompiled_file
,mmap::open_file_for_mmap
,mmap::open_file_for_mmap
… - call-hook
-
Enables support for the
Store::call_hook
API which enables injecting custom logic around all entries/exits from WebAssembly. This has a slight performance cost for all host functions.Affects
async_::CallHookHandler
… - memory-protection-keys = pooling-allocator
-
Enables support for "memory protection keys" which can be used in conjunction with the pooling allocator on x64 to compact linear memory allocations.
- reexport-wasmparser
-
Enables a re-export of wasmparser, so that an embedder of Wasmtime can use exactly the version of the parser library that Wasmtime does. Sometimes this is necessary, e.g. to guarantee that there will not be any mismatches in which modules are accepted due to Wasm feature configuration or support levels.
Note that when this feature is enabled, the version of wasmparser that is re-exported is *not subject to semver*: we reserve the right to make patch releases of Wasmtime that bump the version of wasmparser used, and hence the version re-exported, in semver-incompatible ways. This is the tradeoff that the embedder needs to opt into: in order to stay exactly in sync with an internal detail of Wasmtime, the cost is visibility into potential internal version changes. This is why the re-export is guarded by a feature flag which is off by default. - wave = component-model
-
Enables instances of the traits defined in the wasm-wave crate, which provides a human-readable text format for component values.
Enables wasm-wave ^0.224.0
- custom-virtual-memory
-
For platforms that Wasmtime does not have support for Wasmtime will disable the use of virtual memory by default, for example allocating linear memories with
malloc
instead. This feature can be used, for these platforms, to instead use a C API defined inwasmtime-platform.h
instead.For some more information see https://docs.wasmtime.dev/stability-platform-support.html#support-for-no_std
This feature is not necessary for supported platforms like Unix and Windows as virtual memory is always enabled there.
- custom-native-signals
-
Same as
custom-virtual-memory
above, but for custom signal-handling APIs. - profile-pulley = profiling, pulley
-
Off-by-default support to profile the Pulley interpreter. This has a performance hit, even when not profiling, so it's disabled by default at compile time.
Enables profile of pulley-interpreter
- component-model-async = async, component-model, std
-
Enables support for the Component Model Async ABI, along with
future
,stream
, anderror-context
types.Enables futures, component-model-async of optional wasmtime-component-macro
Features from optional dependencies
In crates that don't use the dep:
syntax, optional dependencies automatically become Cargo features. These features may have been created by mistake, and this functionality may be removed in the future.