wasi-http icon indicating copy to clipboard operation
wasi-http copied to clipboard

streams are not implemented in `wit-bindgen` for C bindings

Open brendandburns opened this issue 1 year ago • 1 comments

If you try to generate bindings for 0.3.0 for C it fails:

RUST_BACKTRACE=1 wit-bindgen c --autodrop-borrows yes ./wasi-http/wit-0.3.0-draft -w client
thread 'main' panicked at crates/c/src/lib.rs:780:43:
not implemented
stack backtrace:
   0: rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::panicking::panic
   3: wit_bindgen_c::push_ty_name
   4: wit_bindgen_c::gen_type_name
   5: wit_bindgen_c::InterfaceGenerator::define_live_types
   6: <wit_bindgen_c::C as wit_bindgen_core::WorldGenerator>::import_interface
   7: wit_bindgen_core::WorldGenerator::generate
   8: wit_bindgen::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

I realize that this is actually a wit-bindgen issue, but I think C bindings should be a blocker for an 0.3.0 release.

brendandburns avatar Apr 18 '24 16:04 brendandburns

Yeah, the only tool that can handle stream and future at this point (AFAIK) is isyswasfa and its temporary forks of wit-bindgen and componentize-py (and those only handle Rust and Python at the moment). It emulates support by transforming the stream and future references in the WIT into resource imports.

I'm currently working on adding support for async lifts and lowers, along with proper (not just emulated) support for stream and future to wit-bindgen, wasm-tools, and wasmtime, and plan to start opening PRs on those projects in the next few weeks. See https://github.com/dicej/component-async-demo for the progress I've made so far.

I agree that C binding support will be a blocker, and I plan to take a crack at it once the other foundational pieces are in place. If you or anyone else are interested in contributing to those efforts, I'd be happy to collaborate.

dicej avatar Apr 18 '24 17:04 dicej