wit-bindgen generates Rust bindings from a WIT interface so a WebAssembly component can call an imported API without hand-writing its interoperability glue. In a wasi:nn component, the generated bindings expose graph and tensor operations used to load an ONNX model, provide input, and read results. section 5.2.2
wit_bindgen::generate!({
path: "wit/wasi-nn.wit",
world: "ml",
});
Generate bindings from the local wasi-nn WIT file and select its ml world before importing the generated wasi::nn APIs. section 5.2.2
WASI neural-network component
Add wit-bindgen with its macros feature, place wasi-nn.wit under wit/, invoke wit_bindgen::generate!, then use the generated Graph, Tensor, and TensorType APIs to run inference. section 5.2.2
