Mounted binaries
The mounted binaries section is for using external services inside a Wasm module. Each record of the form cli_tool_name = cli-tool-path within this section allows you to call a CLI tool located in the cli-tool-path directory.
Consider the following example:
toml
toml
Using this config with adding the following lines in your source code:
rust
rust
allows you to pass an argument as a string to the CLI tool and receive its output as a string.
This import function is a host import function, meaning that wasm_import_module must be equal to "host". Note that the signature of such functions must follow the pattern shown above: cli_tool_name(Vec<String>) -> MountedBinaryResult. This pattern reflects the Rust process API.
Then this function can be used as an ordinary Rust FFI function, but without unsafe block:
rust
rust