Files
wasmtime/crates/component-macro/tests/codegen.rs
Trevor Elliott 85f0c68008 Add only_interfaces and with to the bindgen! macro. (#6160)
* Add `only_interfaces` and `with` to the `bindgen!` macro.

* Add a version of the empty_error test for `only_interfaces` and `with`

* Review feedback

* Add docs
2023-04-10 23:28:52 +00:00

38 lines
1021 B
Rust

macro_rules! gentest {
($id:ident $name:tt $path:tt) => {
mod $id {
mod sugar {
wasmtime::component::bindgen!(in $path);
}
mod normal {
wasmtime::component::bindgen!($name in $path);
}
mod async_ {
wasmtime::component::bindgen!({
path: $path,
async: true,
});
}
mod tracing {
wasmtime::component::bindgen!({
path: $path,
world: $name,
tracing: true,
duplicate_if_necessary: true,
});
}
mod interfaces_only {
wasmtime::component::bindgen!({
path: $path,
world: $name,
only_interfaces: true,
});
}
}
// ...
};
}
component_macro_test_helpers::foreach!(gentest);