Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
bytecodealliance
GitHub Repository: bytecodealliance/wasmtime
Path: blob/main/crates/test-programs/src/bin/async_unit_stream_caller.rs
1693 views
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 {
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`:
27
fn main() {}
28
29