wit-bindgen-cli 0.57.1

CLI tool to generate bindings for WIT documents and the component model.
//@ wasmtime-flags = '-Wcomponent-model-async'

include!(env!("BINDINGS"));

use crate::my::test::i::{ping, pong};

struct Component;

export!(Component);

impl Guest for Component {
    async fn run() {
        let (tx, rx) = wit_future::new(|| unreachable!());
        let f1 = ping(rx, "world".into());
        let f2 = async { tx.write("hello".into()).await.unwrap() };
        let (rx2, ()) = futures::join!(f1, f2);
        let m2 = rx2.await;
        assert_eq!(m2, "helloworld");

        let (tx, rx) = wit_future::new(|| unreachable!());
        let f1 = async move {
            let m3 = pong(rx).await;
            assert_eq!(m3, "helloworld");
        };
        let f2 = async { tx.write(m2).await.unwrap() };
        let ((), ()) = futures::join!(f1, f2);
    }
}