Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
bytecodealliance
GitHub Repository: bytecodealliance/wasmtime
Path: blob/main/crates/misc/component-async-tests/src/lib.rs
3068 views
1
#![expect(clippy::allow_attributes_without_reason)]
2
3
use wasmtime::component::{HasData, ResourceTable};
4
use wasmtime_wasi::{WasiCtx, WasiCtxView, WasiView};
5
6
pub mod borrowing_host;
7
pub mod closed_streams;
8
pub mod resource_stream;
9
pub mod round_trip;
10
pub mod round_trip_direct;
11
pub mod round_trip_many;
12
pub mod sleep;
13
pub mod transmit;
14
pub mod util;
15
pub mod yield_host;
16
17
/// Host implementation, usable primarily by tests
18
pub struct Ctx {
19
pub wasi: WasiCtx,
20
pub table: ResourceTable,
21
pub continue_: bool,
22
}
23
24
impl WasiView for Ctx {
25
fn ctx(&mut self) -> WasiCtxView<'_> {
26
WasiCtxView {
27
ctx: &mut self.wasi,
28
table: &mut self.table,
29
}
30
}
31
}
32
33
impl HasData for Ctx {
34
type Data<'a> = &'a mut Self;
35
}
36
37