Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
bytecodealliance
GitHub Repository: bytecodealliance/wasmtime
Path: blob/main/crates/misc/component-async-tests/src/round_trip.rs
3073 views
1
use super::Ctx;
2
use std::time::Duration;
3
use wasmtime::component::Accessor;
4
5
pub mod bindings {
6
wasmtime::component::bindgen!({
7
path: "wit",
8
world: "round-trip",
9
imports: { default: trappable },
10
});
11
}
12
13
pub mod non_concurrent_export_bindings {
14
wasmtime::component::bindgen!({
15
path: "wit",
16
world: "round-trip",
17
exports: { default: ignore_wit | async },
18
});
19
}
20
21
impl bindings::local::local::baz::HostWithStore for Ctx {
22
async fn foo<T>(_: &Accessor<T, Self>, s: String) -> wasmtime::Result<String> {
23
crate::util::sleep(Duration::from_millis(10)).await;
24
Ok(format!("{s} - entered host - exited host"))
25
}
26
}
27
28
impl bindings::local::local::baz::Host for Ctx {}
29
30