I am currently exploring the add
example for wasm component which is wasi-0.2, from wasmtime component doc diligently following their example, unfortunately it doesn’t run
#[allow(warnings)]
mod bindings;
use bindings::Guest;
struct Component;
impl Guest for Component {
fn add(x: i32, y: i32) -> i32 {
x + y
}
}
bindings::export!(Component with_types_in bindings);
lib.rs
package component:add;
/// An example world for the component to target.
world example {
export add: func(x: s32, y: s32) -> s32;
}
world.wit
Wasmtime Version: wasmtime-cli 21.0.1 (cedf9aa0f 2024-05-22)
Steps to reproduce
- cargo component build –release
- cargo run –release — 1 2 ../add/target/wasm32-wasi/release/add.wasm
Error
error: a bin target must be available for **cargo run**
New contributor
Joshua Aruokhai is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.