Struct Opts

Source
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.

Implementations§

Source§

impl Opts

Source

pub fn generate(&self, resolve: &Resolve, world: WorldId) -> Result<String>

Source

pub fn import_call_style(&self, qualifier: Option<&str>, f: &str) -> CallStyle

Source

pub fn drop_call_style(&self, qualifier: Option<&str>, r: &str) -> CallStyle

Source

pub fn call_style(&self) -> CallStyle

Trait Implementations§

Source§

impl Clone for Opts

Source§

fn clone(&self) -> Opts

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Opts

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Opts

Source§

fn default() -> Opts

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for Opts

§

impl RefUnwindSafe for Opts

§

impl Send for Opts

§

impl Sync for Opts

§

impl Unpin for Opts

§

impl UnwindSafe for Opts

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.