pub struct Opts {Show 17 fields
pub rustfmt: bool,
pub tracing: bool,
pub verbose_tracing: bool,
pub async_: AsyncConfig,
pub concurrent_imports: bool,
pub concurrent_exports: bool,
pub trappable_error_type: Vec<TrappableError>,
pub ownership: Ownership,
pub only_interfaces: bool,
pub trappable_imports: TrappableImports,
pub with: HashMap<String, String>,
pub additional_derive_attributes: Vec<String>,
pub stringify: bool,
pub skip_mut_forwarding_impls: bool,
pub require_store_data_send: bool,
pub wasmtime_crate: Option<String>,
pub debug: bool,
}
Fields§
§rustfmt: bool
Whether or not rustfmt
is executed to format generated code.
tracing: bool
Whether or not to emit tracing
macro calls on function entry/exit.
verbose_tracing: bool
Whether or not tracing
macro calls should included argument and
return values which contain dynamically-sized list
values.
async_: AsyncConfig
Whether or not to use async rust functions and traits.
concurrent_imports: bool
Whether or not to use func_wrap_concurrent
when generating code for
async imports.
Unlike func_wrap_async
, func_wrap_concurrent
allows host functions
to suspend without monopolizing the Store
, meaning other guest tasks
can make progress concurrently.
concurrent_exports: bool
Whether or not to use call_concurrent
when generating code for
async exports.
Unlike call_async
, call_concurrent
allows the caller to make
multiple concurrent calls on the same component instance.
trappable_error_type: Vec<TrappableError>
A list of “trappable errors” which are used to replace the E
in
result<T, E>
found in WIT.
ownership: Ownership
Whether to generate owning or borrowing type definitions.
only_interfaces: bool
Whether or not to generate code for only the interfaces of this wit file or not.
trappable_imports: TrappableImports
Configuration of which imports are allowed to generate a trap.
with: HashMap<String, String>
Remapping of interface names to rust module names. TODO: is there a better type to use for the value of this map?
additional_derive_attributes: Vec<String>
Additional derive attributes to add to generated types. If using in a CLI, this flag can be specified multiple times to add multiple attributes.
These derive attributes will be added to any generated structs or enums
stringify: bool
Evaluate to a string literal containing the generated code rather than the generated tokens themselves. Mostly useful for Wasmtime internal debugging and development.
skip_mut_forwarding_impls: bool
Temporary option to skip impl<T: Trait> Trait for &mut T
for the
wasmtime-wasi
crate while that’s given a chance to update its b
indings.
require_store_data_send: bool
Indicates that the T
in Store<T>
should be send even if async is not
enabled.
This is helpful when sync bindings depend on generated functions from async bindings as is the case with WASI in-tree.
wasmtime_crate: Option<String>
Path to the wasmtime
crate if it’s not the default path.
debug: bool
If true, write the generated bindings to a file for better error
messages from rustc
.
This can also be toggled via the WASMTIME_DEBUG_BINDGEN
environment
variable, but that will affect all bindgen!
macro invocations (and
can sometimes lead to one invocation ovewriting another in unpredictable
ways), whereas this option lets you specify it on a case-by-case basis.