Skip to content

Commit 9d608c1

Browse files
committed
feat: add wasip3 example
Signed-off-by: Andrew Steurer <94206073+asteurer@users.noreply.github.com>
1 parent 53f9add commit 9d608c1

38 files changed

Lines changed: 3388 additions & 3 deletions

examples/wasip2/.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
go.mod
2+
*.wasm
3+
wasi_*
4+
export_wasi_http_handler/wit_bindings.go
5+
wit_*
6+
bin
7+
.crates.toml
8+
.crates2.json
9+
go-*-bootstrap*

examples/wasip2/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
generate-bindings:
2-
wit-bindgen go --world bindings --out-dir . wit
2+
wit-bindgen go --world bindings --out-dir . wit
33

44
build-component: generate-bindings
5-
componentize-go --world bindings componentize
5+
componentize-go --world bindings componentize
66

77
.PHONY: run
88
run: build-component
9-
wasmtime serve -Sp3,cli main.wasm
9+
wasmtime serve -Sp3,cli main.wasm
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package wasi:cli@0.2.0;
2+
3+
interface stdout {
4+
use wasi:io/streams@0.2.0.{output-stream};
5+
6+
get-stdout: func() -> output-stream;
7+
}
8+
9+
interface stderr {
10+
use wasi:io/streams@0.2.0.{output-stream};
11+
12+
get-stderr: func() -> output-stream;
13+
}
14+
15+
interface stdin {
16+
use wasi:io/streams@0.2.0.{input-stream};
17+
18+
get-stdin: func() -> input-stream;
19+
}
20+
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package wasi:clocks@0.2.0;
2+
3+
interface monotonic-clock {
4+
use wasi:io/poll@0.2.0.{pollable};
5+
6+
type instant = u64;
7+
8+
type duration = u64;
9+
10+
now: func() -> instant;
11+
12+
resolution: func() -> duration;
13+
14+
subscribe-instant: func(when: instant) -> pollable;
15+
16+
subscribe-duration: func(when: duration) -> pollable;
17+
}
18+
19+
interface wall-clock {
20+
record datetime {
21+
seconds: u64,
22+
nanoseconds: u32,
23+
}
24+
25+
now: func() -> datetime;
26+
27+
resolution: func() -> datetime;
28+
}
29+

0 commit comments

Comments
 (0)