pub struct Opts {Show 19 fields
pub format: bool,
pub std_feature: bool,
pub raw_strings: bool,
pub skip: Vec<String>,
pub stubs: bool,
pub export_prefix: Option<String>,
pub ownership: Ownership,
pub runtime_path: Option<String>,
pub bitflags_path: Option<String>,
pub additional_derive_attributes: Vec<String>,
pub with: Vec<(String, WithOption)>,
pub generate_all: bool,
pub type_section_suffix: Option<String>,
pub disable_run_ctors_once_workaround: bool,
pub default_bindings_module: Option<String>,
pub export_macro_name: Option<String>,
pub pub_export_macro: bool,
pub generate_unused_types: bool,
pub disable_custom_section_link_helpers: bool,
}
Fields§
§format: bool
Whether or not a formatter is executed to format generated code.
std_feature: bool
If true, code generation should qualify any features that depend on
std
with cfg(feature = "std")
.
raw_strings: bool
If true, code generation should pass borrowed string arguments as
&[u8]
instead of &str
. Strings are still required to be valid
UTF-8, but this avoids the need for Rust code to do its own UTF-8
validation if it doesn’t already have a &str
.
skip: Vec<String>
Names of functions to skip generating bindings for.
stubs: bool
If true, generate stub implementations for any exported functions, interfaces, and/or resources.
export_prefix: Option<String>
Optionally prefix any export names with the specified value.
This is useful to avoid name conflicts when testing.
ownership: Ownership
Whether to generate owning or borrowing type definitions.
Valid values include:
-
owning
: Generated types will be composed entirely of owning fields, regardless of whether they are used as parameters to imports or not. -
borrowing
: Generated types used as parameters to imports will be “deeply borrowing”, i.e. contain references rather than owned values when applicable. -
borrowing-duplicate-if-necessary
: As above, but generating distinct types for borrowing and owning, if necessary.
runtime_path: Option<String>
The optional path to the wit-bindgen runtime module to use.
This defaults to wit_bindgen::rt
.
bitflags_path: Option<String>
The optional path to the bitflags crate to use.
This defaults to wit_bindgen::bitflags
.
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
with: Vec<(String, WithOption)>
Remapping of interface names to rust module names.
Argument must be of the form k=v
and this option can be passed
multiple times or one option can be comma separated, for example
k1=v1,k2=v2
.
generate_all: bool
Indicates that all interfaces not specified in with
should be
generated.
type_section_suffix: Option<String>
Add the specified suffix to the name of the custome section containing the component type.
disable_run_ctors_once_workaround: bool
Disable a workaround used to prevent libc ctors/dtors from being invoked too much.
default_bindings_module: Option<String>
Changes the default module used in the generated export!
macro to
something other than self
.
export_macro_name: Option<String>
Alternative name to use for the export!
macro if one is generated.
pub_export_macro: bool
Ensures that the export!
macro will be defined as pub
so it is a
candidate for being exported outside of the crate.
generate_unused_types: bool
Whether to generate unused structures, not generated by default (false)
disable_custom_section_link_helpers: bool
Whether or not to generate helper function/constants to help link custom sections into the final output.
Disabling this can shave a few bytes off a binary but makes
library-based usage of generate!
prone to breakage.