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