macro_rules! export { ($ty:ident) => { ... }; ($ty:ident with_types_in $($path_to_types_root:tt)*) => { ... }; }
Expand description
Generate an exported instance of the wasi:cli/command
world.
This macro generate the #[no_mangle]
functions necessary to
export this interface. It takes an argument which is a type that
must implement the
exports::cli::run::Guest
trait.
struct MyCliRunner;
impl wasi::exports::cli::run::Guest for MyCliRunner {
fn run() -> Result<(), ()> {
// ...
}
}
wasi::cli::command::export!(MyCliRunner);
§Compatibility with wasm32-wasi
targets
This macro is not compatible with wasm32-wasi
bin
targets which
instead use a fn main()
with the
wasi_snapshot_preview1.command.wasm
adapter. This macro can be
used with the reactor
or proxy
adapters.