1 mod bindings { 2 wit_bindgen::generate!({ 3 path: "../misc/component-async-tests/wit", 4 world: "unit-stream-caller", 5 }); 6 7 use super::Component; 8 export!(Component); 9 } 10 11 use bindings::{exports::local::local::run::Guest, local::local::unit_stream}; 12 13 struct Component; 14 15 impl Guest for Component { run()16 async fn run() { 17 let count = 42; 18 let rx = unit_stream::run(count).await; 19 20 let received = rx.collect().await.len(); 21 22 assert_eq!(count, u32::try_from(received).unwrap()); 23 } 24 } 25 26 // Unused function; required since this file is built as a `bin`: main()27fn main() {} 28