Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
bytecodealliance
GitHub Repository: bytecodealliance/wasmtime
Path: blob/main/crates/test-programs/src/bin/async_round_trip_wait.rs
1693 views
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 bindings::{exports::local::local::baz::Guest as Baz, local::local::baz};
13
14
struct Component;
15
16
impl Baz for Component {
17
fn foo(s: String) -> String {
18
wit_bindgen::block_on(async move {
19
format!(
20
"{} - exited guest",
21
baz::foo(format!("{s} - entered guest")).await
22
)
23
})
24
}
25
}
26
27
// Unused function; required since this file is built as a `bin`:
28
fn main() {}
29
30