1 mod bindings { 2 wit_bindgen::generate!({ 3 path: "../misc/component-async-tests/wit", 4 world: "round-trip", 5 async: ["-export:local:local/baz#[async]foo"], 6 }); 7 8 use super::Component; 9 export!(Component); 10 } 11 12 use { 13 bindings::{exports::local::local::baz::Guest as Baz, local::local::baz}, 14 wit_bindgen_rt::async_support, 15 }; 16 17 struct Component; 18 19 impl Baz for Component { 20 fn foo(s: String) -> String { 21 async_support::block_on(async move { 22 format!( 23 "{} - exited guest", 24 baz::foo(format!("{s} - entered guest")).await 25 ) 26 }) 27 } 28 } 29 30 // Unused function; required since this file is built as a `bin`: 31 fn main() {} 32