From caf3bb14c8e6abeb81e63b1dbba4c6429783eda4 Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Sat, 1 Mar 2025 18:45:59 -0600 Subject: [PATCH] migrate to go.bytecodealliance.org --- examples/component_main/component_main.go | 2 +- examples/component_main/go.mod | 15 +- examples/component_main/go.sum | 10 +- http/go.mod | 4 +- http/go.sum | 4 +- http/main.go | 2 +- lib/go.mod | 2 +- lib/go.sum | 4 +- lib/http/client/transport.go | 2 +- lib/http/server/handler/handler.go | 2 +- lib/wasi/cli/run/run.exports.go | 2 +- lib/wasi/cli/run/run.wit.go | 2 +- lib/wasi/cli/stderr/stderr.wasm.go | 9 + lib/wasi/cli/stderr/stderr.wit.go | 15 +- lib/wasi/cli/stdin/stdin.wasm.go | 9 + lib/wasi/cli/stdin/stdin.wit.go | 15 +- lib/wasi/cli/stdout/stdout.wasm.go | 9 + lib/wasi/cli/stdout/stdout.wit.go | 15 +- .../monotonic-clock/monotonic-clock.wasm.go | 21 + .../monotonic-clock/monotonic-clock.wit.go | 31 +- lib/wasi/clocks/wall-clock/wall-clock.wasm.go | 13 + lib/wasi/clocks/wall-clock/wall-clock.wit.go | 17 +- .../incoming-handler.exports.go | 6 +- .../incoming-handler/incoming-handler.wasm.go | 18 + .../incoming-handler/incoming-handler.wit.go | 18 +- lib/wasi/http/outgoing-handler/abi.go | 8 +- .../outgoing-handler/outgoing-handler.wasm.go | 13 + .../outgoing-handler/outgoing-handler.wit.go | 28 +- lib/wasi/http/types/abi.go | 71 ++- lib/wasi/http/types/types.wasm.go | 257 ++++++++++ lib/wasi/http/types/types.wit.go | 459 +++++++----------- lib/wasi/io/error/error.wasm.go | 13 + lib/wasi/io/error/error.wit.go | 10 +- lib/wasi/io/poll/poll.wasm.go | 25 + lib/wasi/io/poll/poll.wit.go | 20 +- lib/wasi/io/streams/streams.wasm.go | 77 +++ lib/wasi/io/streams/streams.wit.go | 134 ++--- lib/wasi/random/random/random.wasm.go | 17 + lib/wasi/random/random/random.wit.go | 10 +- webserver/wasi-http/go.mod | 6 +- webserver/wasi-http/go.sum | 4 +- 41 files changed, 831 insertions(+), 568 deletions(-) create mode 100755 lib/wasi/cli/stderr/stderr.wasm.go create mode 100755 lib/wasi/cli/stdin/stdin.wasm.go create mode 100755 lib/wasi/cli/stdout/stdout.wasm.go create mode 100755 lib/wasi/clocks/monotonic-clock/monotonic-clock.wasm.go create mode 100755 lib/wasi/clocks/wall-clock/wall-clock.wasm.go create mode 100755 lib/wasi/http/incoming-handler/incoming-handler.wasm.go create mode 100755 lib/wasi/http/outgoing-handler/outgoing-handler.wasm.go create mode 100755 lib/wasi/http/types/types.wasm.go create mode 100755 lib/wasi/io/error/error.wasm.go create mode 100755 lib/wasi/io/poll/poll.wasm.go create mode 100755 lib/wasi/io/streams/streams.wasm.go create mode 100755 lib/wasi/random/random/random.wasm.go diff --git a/examples/component_main/component_main.go b/examples/component_main/component_main.go index 09b1a3e..8251915 100644 --- a/examples/component_main/component_main.go +++ b/examples/component_main/component_main.go @@ -6,7 +6,7 @@ import ( "time" "github.com/dev-wasm/dev-wasm-go/lib/wasi/cli/run" - "github.com/ydnar/wasm-tools-go/cm" + "go.bytecodealliance.org/cm" ) func Run() cm.BoolResult { diff --git a/examples/component_main/go.mod b/examples/component_main/go.mod index 9a96cc0..954ce32 100644 --- a/examples/component_main/go.mod +++ b/examples/component_main/go.mod @@ -1,13 +1,10 @@ module github.com/dev-wasm/dev-wasm-go/examples/component_main -require ( - github.com/dev-wasm/dev-wasm-go v0.0.0-20240903232551-3526e9637f2b // indirect - github.com/dev-wasm/dev-wasm-go/lib v0.0.0-20240903233842-b25e2e499927 // indirect - github.com/ydnar/wasm-tools-go v0.1.5 // indirect -) - -replace github.com/dev-wasm/dev-wasm-go/lib/ v0.0.0 => ../../lib/ +go 1.23.0 -go 1.22.0 +replace github.com/dev-wasm/dev-wasm-go/lib v0.0.0 => ../../lib/ -toolchain go1.23.0 +require ( + github.com/dev-wasm/dev-wasm-go/lib v0.0.0 + go.bytecodealliance.org/cm v0.1.1-0.20250218151459-e57ac0139b6f +) diff --git a/examples/component_main/go.sum b/examples/component_main/go.sum index 4e1001d..2129829 100644 --- a/examples/component_main/go.sum +++ b/examples/component_main/go.sum @@ -1,8 +1,2 @@ -github.com/dev-wasm/dev-wasm-go v0.0.0-20240903232551-3526e9637f2b h1:ePgn3zA/f73orXx0LO/UPL8gausq6w3CGdEfFuq2mFM= -github.com/dev-wasm/dev-wasm-go v0.0.0-20240903232551-3526e9637f2b/go.mod h1:0B1yjENHxtWKjCfmluGgtezq/bfen86rNhVTZBiLo6E= -github.com/dev-wasm/dev-wasm-go/lib v0.0.0-20240828183202-21561ad166e4 h1:WVwIL8iF8suKXHzdVDefkFo1mjYvMOoA5SnLrjrtUOY= -github.com/dev-wasm/dev-wasm-go/lib v0.0.0-20240828183202-21561ad166e4/go.mod h1:eyHGUpflr/37EgTuiJg+m+qz9zVeq6Ffk1ltvWMb8qY= -github.com/dev-wasm/dev-wasm-go/lib v0.0.0-20240903233842-b25e2e499927 h1:6d2BT8T/D7NZ/8sIGFn03t5fuvYlRaVQuxb0IyVzPo8= -github.com/dev-wasm/dev-wasm-go/lib v0.0.0-20240903233842-b25e2e499927/go.mod h1:xi8sLzp98HaAHL9V87SHzaHnO67qi6fyUVH2JRUA4Ds= -github.com/ydnar/wasm-tools-go v0.1.5 h1:ah2WT4gH0IrmN29ZSsjgNC9SPsdXZ+KN+o9uTZqNVSI= -github.com/ydnar/wasm-tools-go v0.1.5/go.mod h1:L3sDi5rbAMJNmMO5cpDRzYYhB0r9xIU0xgpKjwU0Adg= +go.bytecodealliance.org/cm v0.1.1-0.20250218151459-e57ac0139b6f h1:cHJcIruuUZwd7rDdcJHOVotufiO+qPfFwcxb6uCUVSI= +go.bytecodealliance.org/cm v0.1.1-0.20250218151459-e57ac0139b6f/go.mod h1:NZ2UT0DyGhBfpIPOxPMCuG6g1YTR4YF3xweD7mHX5VQ= diff --git a/http/go.mod b/http/go.mod index 2780827..b72f825 100644 --- a/http/go.mod +++ b/http/go.mod @@ -5,8 +5,8 @@ go 1.22.0 toolchain go1.22.5 require ( - github.com/dev-wasm/dev-wasm-go/lib v0.0.0 // indirect - github.com/ydnar/wasm-tools-go v0.1.5 // indirect + github.com/dev-wasm/dev-wasm-go/lib v0.0.0 + go.bytecodealliance.org/cm v0.1.1-0.20250218151459-e57ac0139b6f ) replace github.com/dev-wasm/dev-wasm-go/lib v0.0.0 => ../lib diff --git a/http/go.sum b/http/go.sum index 37b5115..2129829 100644 --- a/http/go.sum +++ b/http/go.sum @@ -1,2 +1,2 @@ -github.com/ydnar/wasm-tools-go v0.1.5 h1:ah2WT4gH0IrmN29ZSsjgNC9SPsdXZ+KN+o9uTZqNVSI= -github.com/ydnar/wasm-tools-go v0.1.5/go.mod h1:L3sDi5rbAMJNmMO5cpDRzYYhB0r9xIU0xgpKjwU0Adg= +go.bytecodealliance.org/cm v0.1.1-0.20250218151459-e57ac0139b6f h1:cHJcIruuUZwd7rDdcJHOVotufiO+qPfFwcxb6uCUVSI= +go.bytecodealliance.org/cm v0.1.1-0.20250218151459-e57ac0139b6f/go.mod h1:NZ2UT0DyGhBfpIPOxPMCuG6g1YTR4YF3xweD7mHX5VQ= diff --git a/http/main.go b/http/main.go index 3726bc8..af0eaaf 100644 --- a/http/main.go +++ b/http/main.go @@ -8,7 +8,7 @@ import ( wasiclient "github.com/dev-wasm/dev-wasm-go/lib/http/client" "github.com/dev-wasm/dev-wasm-go/lib/wasi/cli/run" - "github.com/ydnar/wasm-tools-go/cm" + "go.bytecodealliance.org/cm" ) // This is required for building the module for some reason diff --git a/lib/go.mod b/lib/go.mod index 078ab57..cb3a9c6 100644 --- a/lib/go.mod +++ b/lib/go.mod @@ -2,4 +2,4 @@ module github.com/dev-wasm/dev-wasm-go/lib go 1.22.0 -require github.com/ydnar/wasm-tools-go v0.1.5 +require go.bytecodealliance.org/cm v0.1.1-0.20250218151459-e57ac0139b6f diff --git a/lib/go.sum b/lib/go.sum index 37b5115..2129829 100644 --- a/lib/go.sum +++ b/lib/go.sum @@ -1,2 +1,2 @@ -github.com/ydnar/wasm-tools-go v0.1.5 h1:ah2WT4gH0IrmN29ZSsjgNC9SPsdXZ+KN+o9uTZqNVSI= -github.com/ydnar/wasm-tools-go v0.1.5/go.mod h1:L3sDi5rbAMJNmMO5cpDRzYYhB0r9xIU0xgpKjwU0Adg= +go.bytecodealliance.org/cm v0.1.1-0.20250218151459-e57ac0139b6f h1:cHJcIruuUZwd7rDdcJHOVotufiO+qPfFwcxb6uCUVSI= +go.bytecodealliance.org/cm v0.1.1-0.20250218151459-e57ac0139b6f/go.mod h1:NZ2UT0DyGhBfpIPOxPMCuG6g1YTR4YF3xweD7mHX5VQ= diff --git a/lib/http/client/transport.go b/lib/http/client/transport.go index 8510ff2..bea0870 100644 --- a/lib/http/client/transport.go +++ b/lib/http/client/transport.go @@ -10,7 +10,7 @@ import ( outgoinghandler "github.com/dev-wasm/dev-wasm-go/lib/wasi/http/outgoing-handler" "github.com/dev-wasm/dev-wasm-go/lib/wasi/http/types" - "github.com/ydnar/wasm-tools-go/cm" + "go.bytecodealliance.org/cm" ) const DEFAULT_USER_AGENT = "WASI-HTTP-Go/0.0.2" diff --git a/lib/http/server/handler/handler.go b/lib/http/server/handler/handler.go index 6590fc9..db1fe87 100644 --- a/lib/http/server/handler/handler.go +++ b/lib/http/server/handler/handler.go @@ -8,7 +8,7 @@ import ( incominghandler "github.com/dev-wasm/dev-wasm-go/lib/wasi/http/incoming-handler" "github.com/dev-wasm/dev-wasm-go/lib/wasi/http/types" - "github.com/ydnar/wasm-tools-go/cm" + "go.bytecodealliance.org/cm" ) var h = &handler{ diff --git a/lib/wasi/cli/run/run.exports.go b/lib/wasi/cli/run/run.exports.go index 4325576..647b093 100644 --- a/lib/wasi/cli/run/run.exports.go +++ b/lib/wasi/cli/run/run.exports.go @@ -3,7 +3,7 @@ package run import ( - "github.com/ydnar/wasm-tools-go/cm" + "go.bytecodealliance.org/cm" ) // Exports represents the caller-defined exports from "wasi:cli/run@0.2.0". diff --git a/lib/wasi/cli/run/run.wit.go b/lib/wasi/cli/run/run.wit.go index dd41e72..56ad30b 100644 --- a/lib/wasi/cli/run/run.wit.go +++ b/lib/wasi/cli/run/run.wit.go @@ -4,7 +4,7 @@ package run import ( - "github.com/ydnar/wasm-tools-go/cm" + "go.bytecodealliance.org/cm" ) //go:wasmexport wasi:cli/run@0.2.0#run diff --git a/lib/wasi/cli/stderr/stderr.wasm.go b/lib/wasi/cli/stderr/stderr.wasm.go new file mode 100755 index 0000000..462cf17 --- /dev/null +++ b/lib/wasi/cli/stderr/stderr.wasm.go @@ -0,0 +1,9 @@ +// Code generated by wit-bindgen-go. DO NOT EDIT. + +package stderr + +// This file contains wasmimport and wasmexport declarations for "wasi:cli@0.2.0". + +//go:wasmimport wasi:cli/stderr@0.2.0 get-stderr +//go:noescape +func wasmimport_GetStderr() (result0 uint32) diff --git a/lib/wasi/cli/stderr/stderr.wit.go b/lib/wasi/cli/stderr/stderr.wit.go index 2110710..c7558a8 100644 --- a/lib/wasi/cli/stderr/stderr.wit.go +++ b/lib/wasi/cli/stderr/stderr.wit.go @@ -5,20 +5,21 @@ package stderr import ( "github.com/dev-wasm/dev-wasm-go/lib/wasi/io/streams" - "github.com/ydnar/wasm-tools-go/cm" + "go.bytecodealliance.org/cm" ) +// OutputStream represents the imported type alias "wasi:cli/stderr@0.2.0#output-stream". +// +// See [streams.OutputStream] for more information. +type OutputStream = streams.OutputStream + // GetStderr represents the imported function "get-stderr". // // get-stderr: func() -> output-stream // //go:nosplit -func GetStderr() (result streams.OutputStream) { +func GetStderr() (result OutputStream) { result0 := wasmimport_GetStderr() - result = cm.Reinterpret[streams.OutputStream]((uint32)(result0)) + result = cm.Reinterpret[OutputStream]((uint32)(result0)) return } - -//go:wasmimport wasi:cli/stderr@0.2.0 get-stderr -//go:noescape -func wasmimport_GetStderr() (result0 uint32) diff --git a/lib/wasi/cli/stdin/stdin.wasm.go b/lib/wasi/cli/stdin/stdin.wasm.go new file mode 100755 index 0000000..374eb25 --- /dev/null +++ b/lib/wasi/cli/stdin/stdin.wasm.go @@ -0,0 +1,9 @@ +// Code generated by wit-bindgen-go. DO NOT EDIT. + +package stdin + +// This file contains wasmimport and wasmexport declarations for "wasi:cli@0.2.0". + +//go:wasmimport wasi:cli/stdin@0.2.0 get-stdin +//go:noescape +func wasmimport_GetStdin() (result0 uint32) diff --git a/lib/wasi/cli/stdin/stdin.wit.go b/lib/wasi/cli/stdin/stdin.wit.go index 728e70c..01bf487 100644 --- a/lib/wasi/cli/stdin/stdin.wit.go +++ b/lib/wasi/cli/stdin/stdin.wit.go @@ -5,20 +5,21 @@ package stdin import ( "github.com/dev-wasm/dev-wasm-go/lib/wasi/io/streams" - "github.com/ydnar/wasm-tools-go/cm" + "go.bytecodealliance.org/cm" ) +// InputStream represents the imported type alias "wasi:cli/stdin@0.2.0#input-stream". +// +// See [streams.InputStream] for more information. +type InputStream = streams.InputStream + // GetStdin represents the imported function "get-stdin". // // get-stdin: func() -> input-stream // //go:nosplit -func GetStdin() (result streams.InputStream) { +func GetStdin() (result InputStream) { result0 := wasmimport_GetStdin() - result = cm.Reinterpret[streams.InputStream]((uint32)(result0)) + result = cm.Reinterpret[InputStream]((uint32)(result0)) return } - -//go:wasmimport wasi:cli/stdin@0.2.0 get-stdin -//go:noescape -func wasmimport_GetStdin() (result0 uint32) diff --git a/lib/wasi/cli/stdout/stdout.wasm.go b/lib/wasi/cli/stdout/stdout.wasm.go new file mode 100755 index 0000000..68e4a3d --- /dev/null +++ b/lib/wasi/cli/stdout/stdout.wasm.go @@ -0,0 +1,9 @@ +// Code generated by wit-bindgen-go. DO NOT EDIT. + +package stdout + +// This file contains wasmimport and wasmexport declarations for "wasi:cli@0.2.0". + +//go:wasmimport wasi:cli/stdout@0.2.0 get-stdout +//go:noescape +func wasmimport_GetStdout() (result0 uint32) diff --git a/lib/wasi/cli/stdout/stdout.wit.go b/lib/wasi/cli/stdout/stdout.wit.go index 9565a24..0254ce1 100644 --- a/lib/wasi/cli/stdout/stdout.wit.go +++ b/lib/wasi/cli/stdout/stdout.wit.go @@ -5,20 +5,21 @@ package stdout import ( "github.com/dev-wasm/dev-wasm-go/lib/wasi/io/streams" - "github.com/ydnar/wasm-tools-go/cm" + "go.bytecodealliance.org/cm" ) +// OutputStream represents the imported type alias "wasi:cli/stdout@0.2.0#output-stream". +// +// See [streams.OutputStream] for more information. +type OutputStream = streams.OutputStream + // GetStdout represents the imported function "get-stdout". // // get-stdout: func() -> output-stream // //go:nosplit -func GetStdout() (result streams.OutputStream) { +func GetStdout() (result OutputStream) { result0 := wasmimport_GetStdout() - result = cm.Reinterpret[streams.OutputStream]((uint32)(result0)) + result = cm.Reinterpret[OutputStream]((uint32)(result0)) return } - -//go:wasmimport wasi:cli/stdout@0.2.0 get-stdout -//go:noescape -func wasmimport_GetStdout() (result0 uint32) diff --git a/lib/wasi/clocks/monotonic-clock/monotonic-clock.wasm.go b/lib/wasi/clocks/monotonic-clock/monotonic-clock.wasm.go new file mode 100755 index 0000000..36a1720 --- /dev/null +++ b/lib/wasi/clocks/monotonic-clock/monotonic-clock.wasm.go @@ -0,0 +1,21 @@ +// Code generated by wit-bindgen-go. DO NOT EDIT. + +package monotonicclock + +// This file contains wasmimport and wasmexport declarations for "wasi:clocks@0.2.0". + +//go:wasmimport wasi:clocks/monotonic-clock@0.2.0 now +//go:noescape +func wasmimport_Now() (result0 uint64) + +//go:wasmimport wasi:clocks/monotonic-clock@0.2.0 resolution +//go:noescape +func wasmimport_Resolution() (result0 uint64) + +//go:wasmimport wasi:clocks/monotonic-clock@0.2.0 subscribe-instant +//go:noescape +func wasmimport_SubscribeInstant(when0 uint64) (result0 uint32) + +//go:wasmimport wasi:clocks/monotonic-clock@0.2.0 subscribe-duration +//go:noescape +func wasmimport_SubscribeDuration(when0 uint64) (result0 uint32) diff --git a/lib/wasi/clocks/monotonic-clock/monotonic-clock.wit.go b/lib/wasi/clocks/monotonic-clock/monotonic-clock.wit.go index 9cea4ce..c82a197 100644 --- a/lib/wasi/clocks/monotonic-clock/monotonic-clock.wit.go +++ b/lib/wasi/clocks/monotonic-clock/monotonic-clock.wit.go @@ -16,9 +16,14 @@ package monotonicclock import ( "github.com/dev-wasm/dev-wasm-go/lib/wasi/io/poll" - "github.com/ydnar/wasm-tools-go/cm" + "go.bytecodealliance.org/cm" ) +// Pollable represents the imported type alias "wasi:clocks/monotonic-clock@0.2.0#pollable". +// +// See [poll.Pollable] for more information. +type Pollable = poll.Pollable + // Instant represents the u64 "wasi:clocks/monotonic-clock@0.2.0#instant". // // An instant in time, in nanoseconds. An instant is relative to an @@ -51,10 +56,6 @@ func Now() (result Instant) { return } -//go:wasmimport wasi:clocks/monotonic-clock@0.2.0 now -//go:noescape -func wasmimport_Now() (result0 uint64) - // Resolution represents the imported function "resolution". // // Query the resolution of the clock. Returns the duration of time @@ -69,10 +70,6 @@ func Resolution() (result Duration) { return } -//go:wasmimport wasi:clocks/monotonic-clock@0.2.0 resolution -//go:noescape -func wasmimport_Resolution() (result0 uint64) - // SubscribeInstant represents the imported function "subscribe-instant". // // Create a `pollable` which will resolve once the specified instant @@ -81,17 +78,13 @@ func wasmimport_Resolution() (result0 uint64) // subscribe-instant: func(when: instant) -> pollable // //go:nosplit -func SubscribeInstant(when Instant) (result poll.Pollable) { +func SubscribeInstant(when Instant) (result Pollable) { when0 := (uint64)(when) result0 := wasmimport_SubscribeInstant((uint64)(when0)) - result = cm.Reinterpret[poll.Pollable]((uint32)(result0)) + result = cm.Reinterpret[Pollable]((uint32)(result0)) return } -//go:wasmimport wasi:clocks/monotonic-clock@0.2.0 subscribe-instant -//go:noescape -func wasmimport_SubscribeInstant(when0 uint64) (result0 uint32) - // SubscribeDuration represents the imported function "subscribe-duration". // // Create a `pollable` which will resolve once the given duration has @@ -101,13 +94,9 @@ func wasmimport_SubscribeInstant(when0 uint64) (result0 uint32) // subscribe-duration: func(when: duration) -> pollable // //go:nosplit -func SubscribeDuration(when Duration) (result poll.Pollable) { +func SubscribeDuration(when Duration) (result Pollable) { when0 := (uint64)(when) result0 := wasmimport_SubscribeDuration((uint64)(when0)) - result = cm.Reinterpret[poll.Pollable]((uint32)(result0)) + result = cm.Reinterpret[Pollable]((uint32)(result0)) return } - -//go:wasmimport wasi:clocks/monotonic-clock@0.2.0 subscribe-duration -//go:noescape -func wasmimport_SubscribeDuration(when0 uint64) (result0 uint32) diff --git a/lib/wasi/clocks/wall-clock/wall-clock.wasm.go b/lib/wasi/clocks/wall-clock/wall-clock.wasm.go new file mode 100755 index 0000000..321ff3f --- /dev/null +++ b/lib/wasi/clocks/wall-clock/wall-clock.wasm.go @@ -0,0 +1,13 @@ +// Code generated by wit-bindgen-go. DO NOT EDIT. + +package wallclock + +// This file contains wasmimport and wasmexport declarations for "wasi:clocks@0.2.0". + +//go:wasmimport wasi:clocks/wall-clock@0.2.0 now +//go:noescape +func wasmimport_Now(result *DateTime) + +//go:wasmimport wasi:clocks/wall-clock@0.2.0 resolution +//go:noescape +func wasmimport_Resolution(result *DateTime) diff --git a/lib/wasi/clocks/wall-clock/wall-clock.wit.go b/lib/wasi/clocks/wall-clock/wall-clock.wit.go index a59a313..9c0a968 100644 --- a/lib/wasi/clocks/wall-clock/wall-clock.wit.go +++ b/lib/wasi/clocks/wall-clock/wall-clock.wit.go @@ -18,6 +18,10 @@ // It is intended for reporting the current date and time for humans. package wallclock +import ( + "go.bytecodealliance.org/cm" +) + // DateTime represents the record "wasi:clocks/wall-clock@0.2.0#datetime". // // A time and date in seconds plus nanoseconds. @@ -27,8 +31,9 @@ package wallclock // nanoseconds: u32, // } type DateTime struct { - Seconds uint64 - Nanoseconds uint32 + _ cm.HostLayout `json:"-"` + Seconds uint64 `json:"seconds"` + Nanoseconds uint32 `json:"nanoseconds"` } // Now represents the imported function "now". @@ -55,10 +60,6 @@ func Now() (result DateTime) { return } -//go:wasmimport wasi:clocks/wall-clock@0.2.0 now -//go:noescape -func wasmimport_Now(result *DateTime) - // Resolution represents the imported function "resolution". // // Query the resolution of the clock. @@ -72,7 +73,3 @@ func Resolution() (result DateTime) { wasmimport_Resolution(&result) return } - -//go:wasmimport wasi:clocks/wall-clock@0.2.0 resolution -//go:noescape -func wasmimport_Resolution(result *DateTime) diff --git a/lib/wasi/http/incoming-handler/incoming-handler.exports.go b/lib/wasi/http/incoming-handler/incoming-handler.exports.go index 886d26e..673ccb4 100644 --- a/lib/wasi/http/incoming-handler/incoming-handler.exports.go +++ b/lib/wasi/http/incoming-handler/incoming-handler.exports.go @@ -2,10 +2,6 @@ package incominghandler -import ( - "github.com/dev-wasm/dev-wasm-go/lib/wasi/http/types" -) - // Exports represents the caller-defined exports from "wasi:http/incoming-handler@0.2.0". var Exports struct { // Handle represents the caller-defined, exported function "handle". @@ -22,5 +18,5 @@ var Exports struct { // with an error on its behalf. // // handle: func(request: incoming-request, response-out: response-outparam) - Handle func(request types.IncomingRequest, responseOut types.ResponseOutparam) + Handle func(request IncomingRequest, responseOut ResponseOutparam) } diff --git a/lib/wasi/http/incoming-handler/incoming-handler.wasm.go b/lib/wasi/http/incoming-handler/incoming-handler.wasm.go new file mode 100755 index 0000000..eae429f --- /dev/null +++ b/lib/wasi/http/incoming-handler/incoming-handler.wasm.go @@ -0,0 +1,18 @@ +// Code generated by wit-bindgen-go. DO NOT EDIT. + +package incominghandler + +import ( + "go.bytecodealliance.org/cm" +) + +// This file contains wasmimport and wasmexport declarations for "wasi:http@0.2.0". + +//go:wasmexport wasi:http/incoming-handler@0.2.0#handle +//export wasi:http/incoming-handler@0.2.0#handle +func wasmexport_Handle(request0 uint32, responseOut0 uint32) { + request := cm.Reinterpret[IncomingRequest]((uint32)(request0)) + responseOut := cm.Reinterpret[ResponseOutparam]((uint32)(responseOut0)) + Exports.Handle(request, responseOut) + return +} diff --git a/lib/wasi/http/incoming-handler/incoming-handler.wit.go b/lib/wasi/http/incoming-handler/incoming-handler.wit.go index c238b55..19283f2 100644 --- a/lib/wasi/http/incoming-handler/incoming-handler.wit.go +++ b/lib/wasi/http/incoming-handler/incoming-handler.wit.go @@ -8,14 +8,14 @@ package incominghandler import ( "github.com/dev-wasm/dev-wasm-go/lib/wasi/http/types" - "github.com/ydnar/wasm-tools-go/cm" ) -//go:wasmexport wasi:http/incoming-handler@0.2.0#handle -//export wasi:http/incoming-handler@0.2.0#handle -func wasmexport_Handle(request0 uint32, responseOut0 uint32) { - request := cm.Reinterpret[types.IncomingRequest]((uint32)(request0)) - responseOut := cm.Reinterpret[types.ResponseOutparam]((uint32)(responseOut0)) - Exports.Handle(request, responseOut) - return -} +// IncomingRequest represents the exported type alias "wasi:http/incoming-handler@0.2.0#incoming-request". +// +// See [types.IncomingRequest] for more information. +type IncomingRequest = types.IncomingRequest + +// ResponseOutparam represents the exported type alias "wasi:http/incoming-handler@0.2.0#response-outparam". +// +// See [types.ResponseOutparam] for more information. +type ResponseOutparam = types.ResponseOutparam diff --git a/lib/wasi/http/outgoing-handler/abi.go b/lib/wasi/http/outgoing-handler/abi.go index e53206a..cdc17d0 100644 --- a/lib/wasi/http/outgoing-handler/abi.go +++ b/lib/wasi/http/outgoing-handler/abi.go @@ -3,17 +3,17 @@ package outgoinghandler import ( - "github.com/dev-wasm/dev-wasm-go/lib/wasi/http/types" - "github.com/ydnar/wasm-tools-go/cm" + "go.bytecodealliance.org/cm" "unsafe" ) // ErrorCodeShape is used for storage in variant or result types. type ErrorCodeShape struct { - shape [unsafe.Sizeof(types.ErrorCode{})]byte + _ cm.HostLayout + shape [unsafe.Sizeof(ErrorCode{})]byte } -func lower_OptionRequestOptions(v cm.Option[types.RequestOptions]) (f0 uint32, f1 uint32) { +func lower_OptionRequestOptions(v cm.Option[RequestOptions]) (f0 uint32, f1 uint32) { some := v.Some() if some != nil { f0 = 1 diff --git a/lib/wasi/http/outgoing-handler/outgoing-handler.wasm.go b/lib/wasi/http/outgoing-handler/outgoing-handler.wasm.go new file mode 100755 index 0000000..6b3f382 --- /dev/null +++ b/lib/wasi/http/outgoing-handler/outgoing-handler.wasm.go @@ -0,0 +1,13 @@ +// Code generated by wit-bindgen-go. DO NOT EDIT. + +package outgoinghandler + +import ( + "go.bytecodealliance.org/cm" +) + +// This file contains wasmimport and wasmexport declarations for "wasi:http@0.2.0". + +//go:wasmimport wasi:http/outgoing-handler@0.2.0 handle +//go:noescape +func wasmimport_Handle(request0 uint32, options0 uint32, options1 uint32, result *cm.Result[ErrorCodeShape, FutureIncomingResponse, ErrorCode]) diff --git a/lib/wasi/http/outgoing-handler/outgoing-handler.wit.go b/lib/wasi/http/outgoing-handler/outgoing-handler.wit.go index aa9eb40..5383d15 100644 --- a/lib/wasi/http/outgoing-handler/outgoing-handler.wit.go +++ b/lib/wasi/http/outgoing-handler/outgoing-handler.wit.go @@ -8,9 +8,29 @@ package outgoinghandler import ( "github.com/dev-wasm/dev-wasm-go/lib/wasi/http/types" - "github.com/ydnar/wasm-tools-go/cm" + "go.bytecodealliance.org/cm" ) +// OutgoingRequest represents the imported type alias "wasi:http/outgoing-handler@0.2.0#outgoing-request". +// +// See [types.OutgoingRequest] for more information. +type OutgoingRequest = types.OutgoingRequest + +// RequestOptions represents the imported type alias "wasi:http/outgoing-handler@0.2.0#request-options". +// +// See [types.RequestOptions] for more information. +type RequestOptions = types.RequestOptions + +// FutureIncomingResponse represents the imported type alias "wasi:http/outgoing-handler@0.2.0#future-incoming-response". +// +// See [types.FutureIncomingResponse] for more information. +type FutureIncomingResponse = types.FutureIncomingResponse + +// ErrorCode represents the type alias "wasi:http/outgoing-handler@0.2.0#error-code". +// +// See [types.ErrorCode] for more information. +type ErrorCode = types.ErrorCode + // Handle represents the imported function "handle". // // This function is invoked with an outgoing HTTP Request, and it returns @@ -28,13 +48,9 @@ import ( // error-code> // //go:nosplit -func Handle(request types.OutgoingRequest, options cm.Option[types.RequestOptions]) (result cm.Result[ErrorCodeShape, types.FutureIncomingResponse, types.ErrorCode]) { +func Handle(request OutgoingRequest, options cm.Option[RequestOptions]) (result cm.Result[ErrorCodeShape, FutureIncomingResponse, ErrorCode]) { request0 := cm.Reinterpret[uint32](request) options0, options1 := lower_OptionRequestOptions(options) wasmimport_Handle((uint32)(request0), (uint32)(options0), (uint32)(options1), &result) return } - -//go:wasmimport wasi:http/outgoing-handler@0.2.0 handle -//go:noescape -func wasmimport_Handle(request0 uint32, options0 uint32, options1 uint32, result *cm.Result[ErrorCodeShape, types.FutureIncomingResponse, types.ErrorCode]) diff --git a/lib/wasi/http/types/abi.go b/lib/wasi/http/types/abi.go index ef7bd75..6ffb1fd 100644 --- a/lib/wasi/http/types/abi.go +++ b/lib/wasi/http/types/abi.go @@ -3,13 +3,13 @@ package types import ( - monotonicclock "github.com/dev-wasm/dev-wasm-go/lib/wasi/clocks/monotonic-clock" - "github.com/ydnar/wasm-tools-go/cm" + "go.bytecodealliance.org/cm" "unsafe" ) // OptionFieldSizePayloadShape is used for storage in variant or result types. type OptionFieldSizePayloadShape struct { + _ cm.HostLayout shape [unsafe.Sizeof(cm.Option[FieldSizePayload]{})]byte } @@ -28,7 +28,7 @@ func lower_Method(v Method) (f0 uint32, f1 *uint8, f2 uint32) { f0 = (uint32)(v.Tag()) switch f0 { case 9: // other - v1, v2 := cm.LowerString(*v.Other()) + v1, v2 := cm.LowerString(*cm.Case[string](&v, 9)) f1 = (*uint8)(v1) f2 = (uint32)(v2) } @@ -39,7 +39,7 @@ func lower_Scheme(v Scheme) (f0 uint32, f1 *uint8, f2 uint32) { f0 = (uint32)(v.Tag()) switch f0 { case 2: // other - v1, v2 := cm.LowerString(*v.Other()) + v1, v2 := cm.LowerString(*cm.Case[string](&v, 2)) f1 = (*uint8)(v1) f2 = (uint32)(v2) } @@ -58,7 +58,7 @@ func lower_OptionScheme(v cm.Option[Scheme]) (f0 uint32, f1 uint32, f2 *uint8, f return } -func lower_OptionDuration(v cm.Option[monotonicclock.Duration]) (f0 uint32, f1 uint64) { +func lower_OptionDuration(v cm.Option[Duration]) (f0 uint32, f1 uint64) { some := v.Some() if some != nil { f0 = 1 @@ -70,6 +70,7 @@ func lower_OptionDuration(v cm.Option[monotonicclock.Duration]) (f0 uint32, f1 u // ErrorCodeShape is used for storage in variant or result types. type ErrorCodeShape struct { + _ cm.HostLayout shape [unsafe.Sizeof(ErrorCode{})]byte } @@ -149,86 +150,86 @@ func lower_ErrorCode(v ErrorCode) (f0 uint32, f1 uint32, f2 uint64, f3 uint32, f f0 = (uint32)(v.Tag()) switch f0 { case 1: // DNS-error - v1, v2, v3, v4, v5 := lower_DNSErrorPayload(*v.DNSError()) + v1, v2, v3, v4, v5 := lower_DNSErrorPayload(*cm.Case[DNSErrorPayload](&v, 1)) f1 = (uint32)(v1) - f2 = cm.PointerToU64(v2) + f2 = (uint64)(cm.PointerToU64(v2)) f3 = (uint32)(v3) f4 = (uint32)(v4) f5 = (uint32)(v5) case 14: // TLS-alert-received - v1, v2, v3, v4, v5 := lower_TLSAlertReceivedPayload(*v.TLSAlertReceived()) + v1, v2, v3, v4, v5 := lower_TLSAlertReceivedPayload(*cm.Case[TLSAlertReceivedPayload](&v, 14)) f1 = (uint32)(v1) f2 = (uint64)(v2) f3 = (uint32)(v3) - f4 = cm.PointerToU32(v4) + f4 = (uint32)(cm.PointerToU32(v4)) f5 = (uint32)(v5) case 17: // HTTP-request-body-size - v1, v2 := lower_OptionU64(*v.HTTPRequestBodySize()) + v1, v2 := lower_OptionU64(*cm.Case[cm.Option[uint64]](&v, 17)) f1 = (uint32)(v1) f2 = (uint64)(v2) case 21: // HTTP-request-header-section-size - v1, v2 := lower_OptionU32(*v.HTTPRequestHeaderSectionSize()) + v1, v2 := lower_OptionU32(*cm.Case[cm.Option[uint32]](&v, 21)) f1 = (uint32)(v1) f2 = (uint64)(v2) case 22: // HTTP-request-header-size - v1, v2, v3, v4, v5, v6 := lower_OptionFieldSizePayload(*v.HTTPRequestHeaderSize()) + v1, v2, v3, v4, v5, v6 := lower_OptionFieldSizePayload(*cm.Case[cm.Option[FieldSizePayload]](&v, 22)) f1 = (uint32)(v1) f2 = (uint64)(v2) - f3 = cm.PointerToU32(v3) + f3 = (uint32)(cm.PointerToU32(v3)) f4 = (uint32)(v4) f5 = (uint32)(v5) f6 = (uint32)(v6) case 23: // HTTP-request-trailer-section-size - v1, v2 := lower_OptionU32(*v.HTTPRequestTrailerSectionSize()) + v1, v2 := lower_OptionU32(*cm.Case[cm.Option[uint32]](&v, 23)) f1 = (uint32)(v1) f2 = (uint64)(v2) case 24: // HTTP-request-trailer-size - v1, v2, v3, v4, v5 := lower_FieldSizePayload(*v.HTTPRequestTrailerSize()) + v1, v2, v3, v4, v5 := lower_FieldSizePayload(*cm.Case[FieldSizePayload](&v, 24)) f1 = (uint32)(v1) - f2 = cm.PointerToU64(v2) + f2 = (uint64)(cm.PointerToU64(v2)) f3 = (uint32)(v3) f4 = (uint32)(v4) f5 = (uint32)(v5) case 26: // HTTP-response-header-section-size - v1, v2 := lower_OptionU32(*v.HTTPResponseHeaderSectionSize()) + v1, v2 := lower_OptionU32(*cm.Case[cm.Option[uint32]](&v, 26)) f1 = (uint32)(v1) f2 = (uint64)(v2) case 27: // HTTP-response-header-size - v1, v2, v3, v4, v5 := lower_FieldSizePayload(*v.HTTPResponseHeaderSize()) + v1, v2, v3, v4, v5 := lower_FieldSizePayload(*cm.Case[FieldSizePayload](&v, 27)) f1 = (uint32)(v1) - f2 = cm.PointerToU64(v2) + f2 = (uint64)(cm.PointerToU64(v2)) f3 = (uint32)(v3) f4 = (uint32)(v4) f5 = (uint32)(v5) case 28: // HTTP-response-body-size - v1, v2 := lower_OptionU64(*v.HTTPResponseBodySize()) + v1, v2 := lower_OptionU64(*cm.Case[cm.Option[uint64]](&v, 28)) f1 = (uint32)(v1) f2 = (uint64)(v2) case 29: // HTTP-response-trailer-section-size - v1, v2 := lower_OptionU32(*v.HTTPResponseTrailerSectionSize()) + v1, v2 := lower_OptionU32(*cm.Case[cm.Option[uint32]](&v, 29)) f1 = (uint32)(v1) f2 = (uint64)(v2) case 30: // HTTP-response-trailer-size - v1, v2, v3, v4, v5 := lower_FieldSizePayload(*v.HTTPResponseTrailerSize()) + v1, v2, v3, v4, v5 := lower_FieldSizePayload(*cm.Case[FieldSizePayload](&v, 30)) f1 = (uint32)(v1) - f2 = cm.PointerToU64(v2) + f2 = (uint64)(cm.PointerToU64(v2)) f3 = (uint32)(v3) f4 = (uint32)(v4) f5 = (uint32)(v5) case 31: // HTTP-response-transfer-coding - v1, v2, v3 := lower_OptionString(*v.HTTPResponseTransferCoding()) + v1, v2, v3 := lower_OptionString(*cm.Case[cm.Option[string]](&v, 31)) f1 = (uint32)(v1) - f2 = cm.PointerToU64(v2) + f2 = (uint64)(cm.PointerToU64(v2)) f3 = (uint32)(v3) case 32: // HTTP-response-content-coding - v1, v2, v3 := lower_OptionString(*v.HTTPResponseContentCoding()) + v1, v2, v3 := lower_OptionString(*cm.Case[cm.Option[string]](&v, 32)) f1 = (uint32)(v1) - f2 = cm.PointerToU64(v2) + f2 = (uint64)(cm.PointerToU64(v2)) f3 = (uint32)(v3) case 38: // internal-error - v1, v2, v3 := lower_OptionString(*v.InternalError()) + v1, v2, v3 := lower_OptionString(*cm.Case[cm.Option[string]](&v, 38)) f1 = (uint32)(v1) - f2 = cm.PointerToU64(v2) + f2 = (uint64)(cm.PointerToU64(v2)) f3 = (uint32)(v3) } return @@ -252,12 +253,7 @@ func lower_ResultOutgoingResponseErrorCode(v cm.Result[ErrorCodeShape, OutgoingR return } -// ResultOptionTrailersErrorCodeShape is used for storage in variant or result types. -type ResultOptionTrailersErrorCodeShape struct { - shape [unsafe.Sizeof(cm.Result[ErrorCodeShape, cm.Option[Fields], ErrorCode]{})]byte -} - -func lower_OptionTrailers(v cm.Option[Fields]) (f0 uint32, f1 uint32) { +func lower_OptionTrailers(v cm.Option[Trailers]) (f0 uint32, f1 uint32) { some := v.Some() if some != nil { f0 = 1 @@ -266,8 +262,3 @@ func lower_OptionTrailers(v cm.Option[Fields]) (f0 uint32, f1 uint32) { } return } - -// ResultIncomingResponseErrorCodeShape is used for storage in variant or result types. -type ResultIncomingResponseErrorCodeShape struct { - shape [unsafe.Sizeof(cm.Result[ErrorCodeShape, IncomingResponse, ErrorCode]{})]byte -} diff --git a/lib/wasi/http/types/types.wasm.go b/lib/wasi/http/types/types.wasm.go new file mode 100755 index 0000000..b025b2a --- /dev/null +++ b/lib/wasi/http/types/types.wasm.go @@ -0,0 +1,257 @@ +// Code generated by wit-bindgen-go. DO NOT EDIT. + +package types + +import ( + "go.bytecodealliance.org/cm" +) + +// This file contains wasmimport and wasmexport declarations for "wasi:http@0.2.0". + +//go:wasmimport wasi:http/types@0.2.0 [resource-drop]fields +//go:noescape +func wasmimport_FieldsResourceDrop(self0 uint32) + +//go:wasmimport wasi:http/types@0.2.0 [constructor]fields +//go:noescape +func wasmimport_NewFields() (result0 uint32) + +//go:wasmimport wasi:http/types@0.2.0 [static]fields.from-list +//go:noescape +func wasmimport_FieldsFromList(entries0 *cm.Tuple[FieldKey, FieldValue], entries1 uint32, result *cm.Result[Fields, Fields, HeaderError]) + +//go:wasmimport wasi:http/types@0.2.0 [method]fields.append +//go:noescape +func wasmimport_FieldsAppend(self0 uint32, name0 *uint8, name1 uint32, value0 *uint8, value1 uint32, result *cm.Result[HeaderError, struct{}, HeaderError]) + +//go:wasmimport wasi:http/types@0.2.0 [method]fields.clone +//go:noescape +func wasmimport_FieldsClone(self0 uint32) (result0 uint32) + +//go:wasmimport wasi:http/types@0.2.0 [method]fields.delete +//go:noescape +func wasmimport_FieldsDelete(self0 uint32, name0 *uint8, name1 uint32, result *cm.Result[HeaderError, struct{}, HeaderError]) + +//go:wasmimport wasi:http/types@0.2.0 [method]fields.entries +//go:noescape +func wasmimport_FieldsEntries(self0 uint32, result *cm.List[cm.Tuple[FieldKey, FieldValue]]) + +//go:wasmimport wasi:http/types@0.2.0 [method]fields.get +//go:noescape +func wasmimport_FieldsGet(self0 uint32, name0 *uint8, name1 uint32, result *cm.List[FieldValue]) + +//go:wasmimport wasi:http/types@0.2.0 [method]fields.has +//go:noescape +func wasmimport_FieldsHas(self0 uint32, name0 *uint8, name1 uint32) (result0 uint32) + +//go:wasmimport wasi:http/types@0.2.0 [method]fields.set +//go:noescape +func wasmimport_FieldsSet(self0 uint32, name0 *uint8, name1 uint32, value0 *FieldValue, value1 uint32, result *cm.Result[HeaderError, struct{}, HeaderError]) + +//go:wasmimport wasi:http/types@0.2.0 [resource-drop]incoming-request +//go:noescape +func wasmimport_IncomingRequestResourceDrop(self0 uint32) + +//go:wasmimport wasi:http/types@0.2.0 [method]incoming-request.authority +//go:noescape +func wasmimport_IncomingRequestAuthority(self0 uint32, result *cm.Option[string]) + +//go:wasmimport wasi:http/types@0.2.0 [method]incoming-request.consume +//go:noescape +func wasmimport_IncomingRequestConsume(self0 uint32, result *cm.Result[IncomingBody, IncomingBody, struct{}]) + +//go:wasmimport wasi:http/types@0.2.0 [method]incoming-request.headers +//go:noescape +func wasmimport_IncomingRequestHeaders(self0 uint32) (result0 uint32) + +//go:wasmimport wasi:http/types@0.2.0 [method]incoming-request.method +//go:noescape +func wasmimport_IncomingRequestMethod(self0 uint32, result *Method) + +//go:wasmimport wasi:http/types@0.2.0 [method]incoming-request.path-with-query +//go:noescape +func wasmimport_IncomingRequestPathWithQuery(self0 uint32, result *cm.Option[string]) + +//go:wasmimport wasi:http/types@0.2.0 [method]incoming-request.scheme +//go:noescape +func wasmimport_IncomingRequestScheme(self0 uint32, result *cm.Option[Scheme]) + +//go:wasmimport wasi:http/types@0.2.0 [resource-drop]outgoing-request +//go:noescape +func wasmimport_OutgoingRequestResourceDrop(self0 uint32) + +//go:wasmimport wasi:http/types@0.2.0 [constructor]outgoing-request +//go:noescape +func wasmimport_NewOutgoingRequest(headers0 uint32) (result0 uint32) + +//go:wasmimport wasi:http/types@0.2.0 [method]outgoing-request.authority +//go:noescape +func wasmimport_OutgoingRequestAuthority(self0 uint32, result *cm.Option[string]) + +//go:wasmimport wasi:http/types@0.2.0 [method]outgoing-request.body +//go:noescape +func wasmimport_OutgoingRequestBody(self0 uint32, result *cm.Result[OutgoingBody, OutgoingBody, struct{}]) + +//go:wasmimport wasi:http/types@0.2.0 [method]outgoing-request.headers +//go:noescape +func wasmimport_OutgoingRequestHeaders(self0 uint32) (result0 uint32) + +//go:wasmimport wasi:http/types@0.2.0 [method]outgoing-request.method +//go:noescape +func wasmimport_OutgoingRequestMethod(self0 uint32, result *Method) + +//go:wasmimport wasi:http/types@0.2.0 [method]outgoing-request.path-with-query +//go:noescape +func wasmimport_OutgoingRequestPathWithQuery(self0 uint32, result *cm.Option[string]) + +//go:wasmimport wasi:http/types@0.2.0 [method]outgoing-request.scheme +//go:noescape +func wasmimport_OutgoingRequestScheme(self0 uint32, result *cm.Option[Scheme]) + +//go:wasmimport wasi:http/types@0.2.0 [method]outgoing-request.set-authority +//go:noescape +func wasmimport_OutgoingRequestSetAuthority(self0 uint32, authority0 uint32, authority1 *uint8, authority2 uint32) (result0 uint32) + +//go:wasmimport wasi:http/types@0.2.0 [method]outgoing-request.set-method +//go:noescape +func wasmimport_OutgoingRequestSetMethod(self0 uint32, method0 uint32, method1 *uint8, method2 uint32) (result0 uint32) + +//go:wasmimport wasi:http/types@0.2.0 [method]outgoing-request.set-path-with-query +//go:noescape +func wasmimport_OutgoingRequestSetPathWithQuery(self0 uint32, pathWithQuery0 uint32, pathWithQuery1 *uint8, pathWithQuery2 uint32) (result0 uint32) + +//go:wasmimport wasi:http/types@0.2.0 [method]outgoing-request.set-scheme +//go:noescape +func wasmimport_OutgoingRequestSetScheme(self0 uint32, scheme0 uint32, scheme1 uint32, scheme2 *uint8, scheme3 uint32) (result0 uint32) + +//go:wasmimport wasi:http/types@0.2.0 [resource-drop]request-options +//go:noescape +func wasmimport_RequestOptionsResourceDrop(self0 uint32) + +//go:wasmimport wasi:http/types@0.2.0 [constructor]request-options +//go:noescape +func wasmimport_NewRequestOptions() (result0 uint32) + +//go:wasmimport wasi:http/types@0.2.0 [method]request-options.between-bytes-timeout +//go:noescape +func wasmimport_RequestOptionsBetweenBytesTimeout(self0 uint32, result *cm.Option[Duration]) + +//go:wasmimport wasi:http/types@0.2.0 [method]request-options.connect-timeout +//go:noescape +func wasmimport_RequestOptionsConnectTimeout(self0 uint32, result *cm.Option[Duration]) + +//go:wasmimport wasi:http/types@0.2.0 [method]request-options.first-byte-timeout +//go:noescape +func wasmimport_RequestOptionsFirstByteTimeout(self0 uint32, result *cm.Option[Duration]) + +//go:wasmimport wasi:http/types@0.2.0 [method]request-options.set-between-bytes-timeout +//go:noescape +func wasmimport_RequestOptionsSetBetweenBytesTimeout(self0 uint32, duration0 uint32, duration1 uint64) (result0 uint32) + +//go:wasmimport wasi:http/types@0.2.0 [method]request-options.set-connect-timeout +//go:noescape +func wasmimport_RequestOptionsSetConnectTimeout(self0 uint32, duration0 uint32, duration1 uint64) (result0 uint32) + +//go:wasmimport wasi:http/types@0.2.0 [method]request-options.set-first-byte-timeout +//go:noescape +func wasmimport_RequestOptionsSetFirstByteTimeout(self0 uint32, duration0 uint32, duration1 uint64) (result0 uint32) + +//go:wasmimport wasi:http/types@0.2.0 [resource-drop]response-outparam +//go:noescape +func wasmimport_ResponseOutparamResourceDrop(self0 uint32) + +//go:wasmimport wasi:http/types@0.2.0 [static]response-outparam.set +//go:noescape +func wasmimport_ResponseOutparamSet(param0 uint32, response0 uint32, response1 uint32, response2 uint32, response3 uint64, response4 uint32, response5 uint32, response6 uint32, response7 uint32) + +//go:wasmimport wasi:http/types@0.2.0 [resource-drop]incoming-response +//go:noescape +func wasmimport_IncomingResponseResourceDrop(self0 uint32) + +//go:wasmimport wasi:http/types@0.2.0 [method]incoming-response.consume +//go:noescape +func wasmimport_IncomingResponseConsume(self0 uint32, result *cm.Result[IncomingBody, IncomingBody, struct{}]) + +//go:wasmimport wasi:http/types@0.2.0 [method]incoming-response.headers +//go:noescape +func wasmimport_IncomingResponseHeaders(self0 uint32) (result0 uint32) + +//go:wasmimport wasi:http/types@0.2.0 [method]incoming-response.status +//go:noescape +func wasmimport_IncomingResponseStatus(self0 uint32) (result0 uint32) + +//go:wasmimport wasi:http/types@0.2.0 [resource-drop]incoming-body +//go:noescape +func wasmimport_IncomingBodyResourceDrop(self0 uint32) + +//go:wasmimport wasi:http/types@0.2.0 [static]incoming-body.finish +//go:noescape +func wasmimport_IncomingBodyFinish(this0 uint32) (result0 uint32) + +//go:wasmimport wasi:http/types@0.2.0 [method]incoming-body.stream +//go:noescape +func wasmimport_IncomingBodyStream(self0 uint32, result *cm.Result[InputStream, InputStream, struct{}]) + +//go:wasmimport wasi:http/types@0.2.0 [resource-drop]future-trailers +//go:noescape +func wasmimport_FutureTrailersResourceDrop(self0 uint32) + +//go:wasmimport wasi:http/types@0.2.0 [method]future-trailers.get +//go:noescape +func wasmimport_FutureTrailersGet(self0 uint32, result *cm.Option[cm.Result[cm.Result[ErrorCodeShape, cm.Option[Trailers], ErrorCode], cm.Result[ErrorCodeShape, cm.Option[Trailers], ErrorCode], struct{}]]) + +//go:wasmimport wasi:http/types@0.2.0 [method]future-trailers.subscribe +//go:noescape +func wasmimport_FutureTrailersSubscribe(self0 uint32) (result0 uint32) + +//go:wasmimport wasi:http/types@0.2.0 [resource-drop]outgoing-response +//go:noescape +func wasmimport_OutgoingResponseResourceDrop(self0 uint32) + +//go:wasmimport wasi:http/types@0.2.0 [constructor]outgoing-response +//go:noescape +func wasmimport_NewOutgoingResponse(headers0 uint32) (result0 uint32) + +//go:wasmimport wasi:http/types@0.2.0 [method]outgoing-response.body +//go:noescape +func wasmimport_OutgoingResponseBody(self0 uint32, result *cm.Result[OutgoingBody, OutgoingBody, struct{}]) + +//go:wasmimport wasi:http/types@0.2.0 [method]outgoing-response.headers +//go:noescape +func wasmimport_OutgoingResponseHeaders(self0 uint32) (result0 uint32) + +//go:wasmimport wasi:http/types@0.2.0 [method]outgoing-response.set-status-code +//go:noescape +func wasmimport_OutgoingResponseSetStatusCode(self0 uint32, statusCode0 uint32) (result0 uint32) + +//go:wasmimport wasi:http/types@0.2.0 [method]outgoing-response.status-code +//go:noescape +func wasmimport_OutgoingResponseStatusCode(self0 uint32) (result0 uint32) + +//go:wasmimport wasi:http/types@0.2.0 [resource-drop]outgoing-body +//go:noescape +func wasmimport_OutgoingBodyResourceDrop(self0 uint32) + +//go:wasmimport wasi:http/types@0.2.0 [static]outgoing-body.finish +//go:noescape +func wasmimport_OutgoingBodyFinish(this0 uint32, trailers0 uint32, trailers1 uint32, result *cm.Result[ErrorCode, struct{}, ErrorCode]) + +//go:wasmimport wasi:http/types@0.2.0 [method]outgoing-body.write +//go:noescape +func wasmimport_OutgoingBodyWrite(self0 uint32, result *cm.Result[OutputStream, OutputStream, struct{}]) + +//go:wasmimport wasi:http/types@0.2.0 [resource-drop]future-incoming-response +//go:noescape +func wasmimport_FutureIncomingResponseResourceDrop(self0 uint32) + +//go:wasmimport wasi:http/types@0.2.0 [method]future-incoming-response.get +//go:noescape +func wasmimport_FutureIncomingResponseGet(self0 uint32, result *cm.Option[cm.Result[cm.Result[ErrorCodeShape, IncomingResponse, ErrorCode], cm.Result[ErrorCodeShape, IncomingResponse, ErrorCode], struct{}]]) + +//go:wasmimport wasi:http/types@0.2.0 [method]future-incoming-response.subscribe +//go:noescape +func wasmimport_FutureIncomingResponseSubscribe(self0 uint32) (result0 uint32) + +//go:wasmimport wasi:http/types@0.2.0 http-error-code +//go:noescape +func wasmimport_HTTPErrorCode(err0 uint32, result *cm.Option[ErrorCode]) diff --git a/lib/wasi/http/types/types.wit.go b/lib/wasi/http/types/types.wit.go index 2a0bf47..d2d82ac 100644 --- a/lib/wasi/http/types/types.wit.go +++ b/lib/wasi/http/types/types.wit.go @@ -12,9 +12,34 @@ import ( ioerror "github.com/dev-wasm/dev-wasm-go/lib/wasi/io/error" "github.com/dev-wasm/dev-wasm-go/lib/wasi/io/poll" "github.com/dev-wasm/dev-wasm-go/lib/wasi/io/streams" - "github.com/ydnar/wasm-tools-go/cm" + "go.bytecodealliance.org/cm" ) +// Duration represents the type alias "wasi:http/types@0.2.0#duration". +// +// See [monotonicclock.Duration] for more information. +type Duration = monotonicclock.Duration + +// InputStream represents the imported type alias "wasi:http/types@0.2.0#input-stream". +// +// See [streams.InputStream] for more information. +type InputStream = streams.InputStream + +// OutputStream represents the imported type alias "wasi:http/types@0.2.0#output-stream". +// +// See [streams.OutputStream] for more information. +type OutputStream = streams.OutputStream + +// IOError represents the imported type alias "wasi:http/types@0.2.0#io-error". +// +// See [ioerror.Error] for more information. +type IOError = ioerror.Error + +// Pollable represents the imported type alias "wasi:http/types@0.2.0#pollable". +// +// See [poll.Pollable] for more information. +type Pollable = poll.Pollable + // Method represents the variant "wasi:http/types@0.2.0#method". // // This type corresponds to HTTP standard Methods. @@ -142,6 +167,24 @@ func (self *Method) Other() *string { return cm.Case[string](self, 9) } +var _MethodStrings = [10]string{ + "get", + "head", + "post", + "put", + "delete", + "connect", + "options", + "trace", + "patch", + "other", +} + +// String implements [fmt.Stringer], returning the variant case name of v. +func (v Method) String() string { + return _MethodStrings[v.Tag()] +} + // Scheme represents the variant "wasi:http/types@0.2.0#scheme". // // This type corresponds to HTTP standard Related Schemes. @@ -185,6 +228,17 @@ func (self *Scheme) Other() *string { return cm.Case[string](self, 2) } +var _SchemeStrings = [3]string{ + "HTTP", + "HTTPS", + "other", +} + +// String implements [fmt.Stringer], returning the variant case name of v. +func (v Scheme) String() string { + return _SchemeStrings[v.Tag()] +} + // DNSErrorPayload represents the record "wasi:http/types@0.2.0#DNS-error-payload". // // Defines the case payload type for `DNS-error` above: @@ -194,8 +248,9 @@ func (self *Scheme) Other() *string { // info-code: option, // } type DNSErrorPayload struct { - Rcode cm.Option[string] - InfoCode cm.Option[uint16] + _ cm.HostLayout `json:"-"` + Rcode cm.Option[string] `json:"rcode"` + InfoCode cm.Option[uint16] `json:"info-code"` } // TLSAlertReceivedPayload represents the record "wasi:http/types@0.2.0#TLS-alert-received-payload". @@ -207,8 +262,9 @@ type DNSErrorPayload struct { // alert-message: option, // } type TLSAlertReceivedPayload struct { - AlertID cm.Option[uint8] - AlertMessage cm.Option[string] + _ cm.HostLayout `json:"-"` + AlertID cm.Option[uint8] `json:"alert-id"` + AlertMessage cm.Option[string] `json:"alert-message"` } // FieldSizePayload represents the record "wasi:http/types@0.2.0#field-size-payload". @@ -220,8 +276,9 @@ type TLSAlertReceivedPayload struct { // field-size: option, // } type FieldSizePayload struct { - FieldName cm.Option[string] - FieldSize cm.Option[uint32] + _ cm.HostLayout `json:"-"` + FieldName cm.Option[string] `json:"field-name"` + FieldSize cm.Option[uint32] `json:"field-size"` } // ErrorCode represents the variant "wasi:http/types@0.2.0#error-code". @@ -692,6 +749,53 @@ func (self *ErrorCode) InternalError() *cm.Option[string] { return cm.Case[cm.Option[string]](self, 38) } +var _ErrorCodeStrings = [39]string{ + "DNS-timeout", + "DNS-error", + "destination-not-found", + "destination-unavailable", + "destination-IP-prohibited", + "destination-IP-unroutable", + "connection-refused", + "connection-terminated", + "connection-timeout", + "connection-read-timeout", + "connection-write-timeout", + "connection-limit-reached", + "TLS-protocol-error", + "TLS-certificate-error", + "TLS-alert-received", + "HTTP-request-denied", + "HTTP-request-length-required", + "HTTP-request-body-size", + "HTTP-request-method-invalid", + "HTTP-request-URI-invalid", + "HTTP-request-URI-too-long", + "HTTP-request-header-section-size", + "HTTP-request-header-size", + "HTTP-request-trailer-section-size", + "HTTP-request-trailer-size", + "HTTP-response-incomplete", + "HTTP-response-header-section-size", + "HTTP-response-header-size", + "HTTP-response-body-size", + "HTTP-response-trailer-section-size", + "HTTP-response-trailer-size", + "HTTP-response-transfer-coding", + "HTTP-response-content-coding", + "HTTP-response-timeout", + "HTTP-upgrade-failed", + "HTTP-protocol-error", + "loop-detected", + "configuration-error", + "internal-error", +} + +// String implements [fmt.Stringer], returning the variant case name of v. +func (v ErrorCode) String() string { + return _ErrorCodeStrings[v.Tag()] +} + // HeaderError represents the variant "wasi:http/types@0.2.0#header-error". // // This type enumerates the different kinds of errors that may occur when @@ -719,7 +823,7 @@ const ( HeaderErrorImmutable ) -var stringsHeaderError = [3]string{ +var _HeaderErrorStrings = [3]string{ "invalid-syntax", "forbidden", "immutable", @@ -727,9 +831,22 @@ var stringsHeaderError = [3]string{ // String implements [fmt.Stringer], returning the enum case name of e. func (e HeaderError) String() string { - return stringsHeaderError[e] + return _HeaderErrorStrings[e] +} + +// MarshalText implements [encoding.TextMarshaler]. +func (e HeaderError) MarshalText() ([]byte, error) { + return []byte(e.String()), nil +} + +// UnmarshalText implements [encoding.TextUnmarshaler], unmarshaling into an enum +// case. Returns an error if the supplied text is not one of the enum cases. +func (e *HeaderError) UnmarshalText(text []byte) error { + return _HeaderErrorUnmarshalCase(e, text) } +var _HeaderErrorUnmarshalCase = cm.CaseUnmarshaler[HeaderError](_HeaderErrorStrings[:]) + // FieldKey represents the string "wasi:http/types@0.2.0#field-key". // // Field keys are always strings. @@ -773,10 +890,6 @@ func (self Fields) ResourceDrop() { return } -//go:wasmimport wasi:http/types@0.2.0 [resource-drop]fields -//go:noescape -func wasmimport_FieldsResourceDrop(self0 uint32) - // NewFields represents the imported constructor for resource "fields". // // Construct an empty HTTP Fields. @@ -792,10 +905,6 @@ func NewFields() (result Fields) { return } -//go:wasmimport wasi:http/types@0.2.0 [constructor]fields -//go:noescape -func wasmimport_NewFields() (result0 uint32) - // FieldsFromList represents the imported static function "from-list". // // Construct an HTTP Fields. @@ -824,10 +933,6 @@ func FieldsFromList(entries cm.List[cm.Tuple[FieldKey, FieldValue]]) (result cm. return } -//go:wasmimport wasi:http/types@0.2.0 [static]fields.from-list -//go:noescape -func wasmimport_FieldsFromList(entries0 *cm.Tuple[FieldKey, FieldValue], entries1 uint32, result *cm.Result[Fields, Fields, HeaderError]) - // Append represents the imported method "append". // // Append a value for a key. Does not change or delete any existing @@ -846,10 +951,6 @@ func (self Fields) Append(name FieldKey, value FieldValue) (result cm.Result[Hea return } -//go:wasmimport wasi:http/types@0.2.0 [method]fields.append -//go:noescape -func wasmimport_FieldsAppend(self0 uint32, name0 *uint8, name1 uint32, value0 *uint8, value1 uint32, result *cm.Result[HeaderError, struct{}, HeaderError]) - // Clone represents the imported method "clone". // // Make a deep copy of the Fields. Equivelant in behavior to calling the @@ -866,10 +967,6 @@ func (self Fields) Clone() (result Fields) { return } -//go:wasmimport wasi:http/types@0.2.0 [method]fields.clone -//go:noescape -func wasmimport_FieldsClone(self0 uint32) (result0 uint32) - // Delete represents the imported method "delete". // // Delete all values for a key. Does nothing if no values for the key @@ -887,10 +984,6 @@ func (self Fields) Delete(name FieldKey) (result cm.Result[HeaderError, struct{} return } -//go:wasmimport wasi:http/types@0.2.0 [method]fields.delete -//go:noescape -func wasmimport_FieldsDelete(self0 uint32, name0 *uint8, name1 uint32, result *cm.Result[HeaderError, struct{}, HeaderError]) - // Entries represents the imported method "entries". // // Retrieve the full set of keys and values in the Fields. Like the @@ -909,10 +1002,6 @@ func (self Fields) Entries() (result cm.List[cm.Tuple[FieldKey, FieldValue]]) { return } -//go:wasmimport wasi:http/types@0.2.0 [method]fields.entries -//go:noescape -func wasmimport_FieldsEntries(self0 uint32, result *cm.List[cm.Tuple[FieldKey, FieldValue]]) - // Get represents the imported method "get". // // Get all of the values corresponding to a key. If the key is not present @@ -930,10 +1019,6 @@ func (self Fields) Get(name FieldKey) (result cm.List[FieldValue]) { return } -//go:wasmimport wasi:http/types@0.2.0 [method]fields.get -//go:noescape -func wasmimport_FieldsGet(self0 uint32, name0 *uint8, name1 uint32, result *cm.List[FieldValue]) - // Has represents the imported method "has". // // Returns `true` when the key is present in this `fields`. If the key is @@ -946,14 +1031,10 @@ func (self Fields) Has(name FieldKey) (result bool) { self0 := cm.Reinterpret[uint32](self) name0, name1 := cm.LowerString(name) result0 := wasmimport_FieldsHas((uint32)(self0), (*uint8)(name0), (uint32)(name1)) - result = cm.U32ToBool((uint32)(result0)) + result = (bool)(cm.U32ToBool((uint32)(result0))) return } -//go:wasmimport wasi:http/types@0.2.0 [method]fields.has -//go:noescape -func wasmimport_FieldsHas(self0 uint32, name0 *uint8, name1 uint32) (result0 uint32) - // Set represents the imported method "set". // // Set all of the values for a key. Clears any existing values for that @@ -972,9 +1053,15 @@ func (self Fields) Set(name FieldKey, value cm.List[FieldValue]) (result cm.Resu return } -//go:wasmimport wasi:http/types@0.2.0 [method]fields.set -//go:noescape -func wasmimport_FieldsSet(self0 uint32, name0 *uint8, name1 uint32, value0 *FieldValue, value1 uint32, result *cm.Result[HeaderError, struct{}, HeaderError]) +// Headers represents the imported type alias "wasi:http/types@0.2.0#headers". +// +// See [Fields] for more information. +type Headers = Fields + +// Trailers represents the imported type alias "wasi:http/types@0.2.0#trailers". +// +// See [Fields] for more information. +type Trailers = Fields // IncomingRequest represents the imported resource "wasi:http/types@0.2.0#incoming-request". // @@ -994,10 +1081,6 @@ func (self IncomingRequest) ResourceDrop() { return } -//go:wasmimport wasi:http/types@0.2.0 [resource-drop]incoming-request -//go:noescape -func wasmimport_IncomingRequestResourceDrop(self0 uint32) - // Authority represents the imported method "authority". // // Returns the authority from the request, if it was present. @@ -1011,10 +1094,6 @@ func (self IncomingRequest) Authority() (result cm.Option[string]) { return } -//go:wasmimport wasi:http/types@0.2.0 [method]incoming-request.authority -//go:noescape -func wasmimport_IncomingRequestAuthority(self0 uint32, result *cm.Option[string]) - // Consume represents the imported method "consume". // // Gives the `incoming-body` associated with this request. Will only @@ -1029,10 +1108,6 @@ func (self IncomingRequest) Consume() (result cm.Result[IncomingBody, IncomingBo return } -//go:wasmimport wasi:http/types@0.2.0 [method]incoming-request.consume -//go:noescape -func wasmimport_IncomingRequestConsume(self0 uint32, result *cm.Result[IncomingBody, IncomingBody, struct{}]) - // Headers represents the imported method "headers". // // Get the `headers` associated with the request. @@ -1047,17 +1122,13 @@ func wasmimport_IncomingRequestConsume(self0 uint32, result *cm.Result[IncomingB // headers: func() -> headers // //go:nosplit -func (self IncomingRequest) Headers() (result Fields) { +func (self IncomingRequest) Headers() (result Headers) { self0 := cm.Reinterpret[uint32](self) result0 := wasmimport_IncomingRequestHeaders((uint32)(self0)) - result = cm.Reinterpret[Fields]((uint32)(result0)) + result = cm.Reinterpret[Headers]((uint32)(result0)) return } -//go:wasmimport wasi:http/types@0.2.0 [method]incoming-request.headers -//go:noescape -func wasmimport_IncomingRequestHeaders(self0 uint32) (result0 uint32) - // Method represents the imported method "method". // // Returns the method of the incoming request. @@ -1071,10 +1142,6 @@ func (self IncomingRequest) Method() (result Method) { return } -//go:wasmimport wasi:http/types@0.2.0 [method]incoming-request.method -//go:noescape -func wasmimport_IncomingRequestMethod(self0 uint32, result *Method) - // PathWithQuery represents the imported method "path-with-query". // // Returns the path with query parameters from the request, as a string. @@ -1088,10 +1155,6 @@ func (self IncomingRequest) PathWithQuery() (result cm.Option[string]) { return } -//go:wasmimport wasi:http/types@0.2.0 [method]incoming-request.path-with-query -//go:noescape -func wasmimport_IncomingRequestPathWithQuery(self0 uint32, result *cm.Option[string]) - // Scheme represents the imported method "scheme". // // Returns the protocol scheme from the request. @@ -1105,10 +1168,6 @@ func (self IncomingRequest) Scheme() (result cm.Option[Scheme]) { return } -//go:wasmimport wasi:http/types@0.2.0 [method]incoming-request.scheme -//go:noescape -func wasmimport_IncomingRequestScheme(self0 uint32, result *cm.Option[Scheme]) - // OutgoingRequest represents the imported resource "wasi:http/types@0.2.0#outgoing-request". // // Represents an outgoing HTTP Request. @@ -1127,10 +1186,6 @@ func (self OutgoingRequest) ResourceDrop() { return } -//go:wasmimport wasi:http/types@0.2.0 [resource-drop]outgoing-request -//go:noescape -func wasmimport_OutgoingRequestResourceDrop(self0 uint32) - // NewOutgoingRequest represents the imported constructor for resource "outgoing-request". // // Construct a new `outgoing-request` with a default `method` of `GET`, and @@ -1147,17 +1202,13 @@ func wasmimport_OutgoingRequestResourceDrop(self0 uint32) // constructor(headers: headers) // //go:nosplit -func NewOutgoingRequest(headers Fields) (result OutgoingRequest) { +func NewOutgoingRequest(headers Headers) (result OutgoingRequest) { headers0 := cm.Reinterpret[uint32](headers) result0 := wasmimport_NewOutgoingRequest((uint32)(headers0)) result = cm.Reinterpret[OutgoingRequest]((uint32)(result0)) return } -//go:wasmimport wasi:http/types@0.2.0 [constructor]outgoing-request -//go:noescape -func wasmimport_NewOutgoingRequest(headers0 uint32) (result0 uint32) - // Authority represents the imported method "authority". // // Get the HTTP Authority for the Request. A value of `none` may be used @@ -1173,10 +1224,6 @@ func (self OutgoingRequest) Authority() (result cm.Option[string]) { return } -//go:wasmimport wasi:http/types@0.2.0 [method]outgoing-request.authority -//go:noescape -func wasmimport_OutgoingRequestAuthority(self0 uint32, result *cm.Option[string]) - // Body represents the imported method "body". // // Returns the resource corresponding to the outgoing Body for this @@ -1195,10 +1242,6 @@ func (self OutgoingRequest) Body() (result cm.Result[OutgoingBody, OutgoingBody, return } -//go:wasmimport wasi:http/types@0.2.0 [method]outgoing-request.body -//go:noescape -func wasmimport_OutgoingRequestBody(self0 uint32, result *cm.Result[OutgoingBody, OutgoingBody, struct{}]) - // Headers represents the imported method "headers". // // Get the headers associated with the Request. @@ -1213,17 +1256,13 @@ func wasmimport_OutgoingRequestBody(self0 uint32, result *cm.Result[OutgoingBody // headers: func() -> headers // //go:nosplit -func (self OutgoingRequest) Headers() (result Fields) { +func (self OutgoingRequest) Headers() (result Headers) { self0 := cm.Reinterpret[uint32](self) result0 := wasmimport_OutgoingRequestHeaders((uint32)(self0)) - result = cm.Reinterpret[Fields]((uint32)(result0)) + result = cm.Reinterpret[Headers]((uint32)(result0)) return } -//go:wasmimport wasi:http/types@0.2.0 [method]outgoing-request.headers -//go:noescape -func wasmimport_OutgoingRequestHeaders(self0 uint32) (result0 uint32) - // Method represents the imported method "method". // // Get the Method for the Request. @@ -1237,10 +1276,6 @@ func (self OutgoingRequest) Method() (result Method) { return } -//go:wasmimport wasi:http/types@0.2.0 [method]outgoing-request.method -//go:noescape -func wasmimport_OutgoingRequestMethod(self0 uint32, result *Method) - // PathWithQuery represents the imported method "path-with-query". // // Get the combination of the HTTP Path and Query for the Request. @@ -1255,10 +1290,6 @@ func (self OutgoingRequest) PathWithQuery() (result cm.Option[string]) { return } -//go:wasmimport wasi:http/types@0.2.0 [method]outgoing-request.path-with-query -//go:noescape -func wasmimport_OutgoingRequestPathWithQuery(self0 uint32, result *cm.Option[string]) - // Scheme represents the imported method "scheme". // // Get the HTTP Related Scheme for the Request. When `none`, the @@ -1273,10 +1304,6 @@ func (self OutgoingRequest) Scheme() (result cm.Option[Scheme]) { return } -//go:wasmimport wasi:http/types@0.2.0 [method]outgoing-request.scheme -//go:noescape -func wasmimport_OutgoingRequestScheme(self0 uint32, result *cm.Option[Scheme]) - // SetAuthority represents the imported method "set-authority". // // Set the HTTP Authority for the Request. A value of `none` may be used @@ -1291,14 +1318,10 @@ func (self OutgoingRequest) SetAuthority(authority cm.Option[string]) (result cm self0 := cm.Reinterpret[uint32](self) authority0, authority1, authority2 := lower_OptionString(authority) result0 := wasmimport_OutgoingRequestSetAuthority((uint32)(self0), (uint32)(authority0), (*uint8)(authority1), (uint32)(authority2)) - result = (cm.BoolResult)(cm.U32ToBool((uint32)(result0))) + result = (cm.BoolResult)((bool)(cm.U32ToBool((uint32)(result0)))) return } -//go:wasmimport wasi:http/types@0.2.0 [method]outgoing-request.set-authority -//go:noescape -func wasmimport_OutgoingRequestSetAuthority(self0 uint32, authority0 uint32, authority1 *uint8, authority2 uint32) (result0 uint32) - // SetMethod represents the imported method "set-method". // // Set the Method for the Request. Fails if the string present in a @@ -1311,14 +1334,10 @@ func (self OutgoingRequest) SetMethod(method Method) (result cm.BoolResult) { self0 := cm.Reinterpret[uint32](self) method0, method1, method2 := lower_Method(method) result0 := wasmimport_OutgoingRequestSetMethod((uint32)(self0), (uint32)(method0), (*uint8)(method1), (uint32)(method2)) - result = (cm.BoolResult)(cm.U32ToBool((uint32)(result0))) + result = (cm.BoolResult)((bool)(cm.U32ToBool((uint32)(result0)))) return } -//go:wasmimport wasi:http/types@0.2.0 [method]outgoing-request.set-method -//go:noescape -func wasmimport_OutgoingRequestSetMethod(self0 uint32, method0 uint32, method1 *uint8, method2 uint32) (result0 uint32) - // SetPathWithQuery represents the imported method "set-path-with-query". // // Set the combination of the HTTP Path and Query for the Request. @@ -1332,14 +1351,10 @@ func (self OutgoingRequest) SetPathWithQuery(pathWithQuery cm.Option[string]) (r self0 := cm.Reinterpret[uint32](self) pathWithQuery0, pathWithQuery1, pathWithQuery2 := lower_OptionString(pathWithQuery) result0 := wasmimport_OutgoingRequestSetPathWithQuery((uint32)(self0), (uint32)(pathWithQuery0), (*uint8)(pathWithQuery1), (uint32)(pathWithQuery2)) - result = (cm.BoolResult)(cm.U32ToBool((uint32)(result0))) + result = (cm.BoolResult)((bool)(cm.U32ToBool((uint32)(result0)))) return } -//go:wasmimport wasi:http/types@0.2.0 [method]outgoing-request.set-path-with-query -//go:noescape -func wasmimport_OutgoingRequestSetPathWithQuery(self0 uint32, pathWithQuery0 uint32, pathWithQuery1 *uint8, pathWithQuery2 uint32) (result0 uint32) - // SetScheme represents the imported method "set-scheme". // // Set the HTTP Related Scheme for the Request. When `none`, the @@ -1353,14 +1368,10 @@ func (self OutgoingRequest) SetScheme(scheme cm.Option[Scheme]) (result cm.BoolR self0 := cm.Reinterpret[uint32](self) scheme0, scheme1, scheme2, scheme3 := lower_OptionScheme(scheme) result0 := wasmimport_OutgoingRequestSetScheme((uint32)(self0), (uint32)(scheme0), (uint32)(scheme1), (*uint8)(scheme2), (uint32)(scheme3)) - result = (cm.BoolResult)(cm.U32ToBool((uint32)(result0))) + result = (cm.BoolResult)((bool)(cm.U32ToBool((uint32)(result0)))) return } -//go:wasmimport wasi:http/types@0.2.0 [method]outgoing-request.set-scheme -//go:noescape -func wasmimport_OutgoingRequestSetScheme(self0 uint32, scheme0 uint32, scheme1 uint32, scheme2 *uint8, scheme3 uint32) (result0 uint32) - // RequestOptions represents the imported resource "wasi:http/types@0.2.0#request-options". // // Parameters for making an HTTP Request. Each of these parameters is @@ -1384,10 +1395,6 @@ func (self RequestOptions) ResourceDrop() { return } -//go:wasmimport wasi:http/types@0.2.0 [resource-drop]request-options -//go:noescape -func wasmimport_RequestOptionsResourceDrop(self0 uint32) - // NewRequestOptions represents the imported constructor for resource "request-options". // // Construct a default `request-options` value. @@ -1401,10 +1408,6 @@ func NewRequestOptions() (result RequestOptions) { return } -//go:wasmimport wasi:http/types@0.2.0 [constructor]request-options -//go:noescape -func wasmimport_NewRequestOptions() (result0 uint32) - // BetweenBytesTimeout represents the imported method "between-bytes-timeout". // // The timeout for receiving subsequent chunks of bytes in the Response @@ -1413,16 +1416,12 @@ func wasmimport_NewRequestOptions() (result0 uint32) // between-bytes-timeout: func() -> option // //go:nosplit -func (self RequestOptions) BetweenBytesTimeout() (result cm.Option[monotonicclock.Duration]) { +func (self RequestOptions) BetweenBytesTimeout() (result cm.Option[Duration]) { self0 := cm.Reinterpret[uint32](self) wasmimport_RequestOptionsBetweenBytesTimeout((uint32)(self0), &result) return } -//go:wasmimport wasi:http/types@0.2.0 [method]request-options.between-bytes-timeout -//go:noescape -func wasmimport_RequestOptionsBetweenBytesTimeout(self0 uint32, result *cm.Option[monotonicclock.Duration]) - // ConnectTimeout represents the imported method "connect-timeout". // // The timeout for the initial connect to the HTTP Server. @@ -1430,16 +1429,12 @@ func wasmimport_RequestOptionsBetweenBytesTimeout(self0 uint32, result *cm.Optio // connect-timeout: func() -> option // //go:nosplit -func (self RequestOptions) ConnectTimeout() (result cm.Option[monotonicclock.Duration]) { +func (self RequestOptions) ConnectTimeout() (result cm.Option[Duration]) { self0 := cm.Reinterpret[uint32](self) wasmimport_RequestOptionsConnectTimeout((uint32)(self0), &result) return } -//go:wasmimport wasi:http/types@0.2.0 [method]request-options.connect-timeout -//go:noescape -func wasmimport_RequestOptionsConnectTimeout(self0 uint32, result *cm.Option[monotonicclock.Duration]) - // FirstByteTimeout represents the imported method "first-byte-timeout". // // The timeout for receiving the first byte of the Response body. @@ -1447,16 +1442,12 @@ func wasmimport_RequestOptionsConnectTimeout(self0 uint32, result *cm.Option[mon // first-byte-timeout: func() -> option // //go:nosplit -func (self RequestOptions) FirstByteTimeout() (result cm.Option[monotonicclock.Duration]) { +func (self RequestOptions) FirstByteTimeout() (result cm.Option[Duration]) { self0 := cm.Reinterpret[uint32](self) wasmimport_RequestOptionsFirstByteTimeout((uint32)(self0), &result) return } -//go:wasmimport wasi:http/types@0.2.0 [method]request-options.first-byte-timeout -//go:noescape -func wasmimport_RequestOptionsFirstByteTimeout(self0 uint32, result *cm.Option[monotonicclock.Duration]) - // SetBetweenBytesTimeout represents the imported method "set-between-bytes-timeout". // // Set the timeout for receiving subsequent chunks of bytes in the Response @@ -1466,18 +1457,14 @@ func wasmimport_RequestOptionsFirstByteTimeout(self0 uint32, result *cm.Option[m // set-between-bytes-timeout: func(duration: option) -> result // //go:nosplit -func (self RequestOptions) SetBetweenBytesTimeout(duration cm.Option[monotonicclock.Duration]) (result cm.BoolResult) { +func (self RequestOptions) SetBetweenBytesTimeout(duration cm.Option[Duration]) (result cm.BoolResult) { self0 := cm.Reinterpret[uint32](self) duration0, duration1 := lower_OptionDuration(duration) result0 := wasmimport_RequestOptionsSetBetweenBytesTimeout((uint32)(self0), (uint32)(duration0), (uint64)(duration1)) - result = (cm.BoolResult)(cm.U32ToBool((uint32)(result0))) + result = (cm.BoolResult)((bool)(cm.U32ToBool((uint32)(result0)))) return } -//go:wasmimport wasi:http/types@0.2.0 [method]request-options.set-between-bytes-timeout -//go:noescape -func wasmimport_RequestOptionsSetBetweenBytesTimeout(self0 uint32, duration0 uint32, duration1 uint64) (result0 uint32) - // SetConnectTimeout represents the imported method "set-connect-timeout". // // Set the timeout for the initial connect to the HTTP Server. An error @@ -1486,18 +1473,14 @@ func wasmimport_RequestOptionsSetBetweenBytesTimeout(self0 uint32, duration0 uin // set-connect-timeout: func(duration: option) -> result // //go:nosplit -func (self RequestOptions) SetConnectTimeout(duration cm.Option[monotonicclock.Duration]) (result cm.BoolResult) { +func (self RequestOptions) SetConnectTimeout(duration cm.Option[Duration]) (result cm.BoolResult) { self0 := cm.Reinterpret[uint32](self) duration0, duration1 := lower_OptionDuration(duration) result0 := wasmimport_RequestOptionsSetConnectTimeout((uint32)(self0), (uint32)(duration0), (uint64)(duration1)) - result = (cm.BoolResult)(cm.U32ToBool((uint32)(result0))) + result = (cm.BoolResult)((bool)(cm.U32ToBool((uint32)(result0)))) return } -//go:wasmimport wasi:http/types@0.2.0 [method]request-options.set-connect-timeout -//go:noescape -func wasmimport_RequestOptionsSetConnectTimeout(self0 uint32, duration0 uint32, duration1 uint64) (result0 uint32) - // SetFirstByteTimeout represents the imported method "set-first-byte-timeout". // // Set the timeout for receiving the first byte of the Response body. An @@ -1506,18 +1489,14 @@ func wasmimport_RequestOptionsSetConnectTimeout(self0 uint32, duration0 uint32, // set-first-byte-timeout: func(duration: option) -> result // //go:nosplit -func (self RequestOptions) SetFirstByteTimeout(duration cm.Option[monotonicclock.Duration]) (result cm.BoolResult) { +func (self RequestOptions) SetFirstByteTimeout(duration cm.Option[Duration]) (result cm.BoolResult) { self0 := cm.Reinterpret[uint32](self) duration0, duration1 := lower_OptionDuration(duration) result0 := wasmimport_RequestOptionsSetFirstByteTimeout((uint32)(self0), (uint32)(duration0), (uint64)(duration1)) - result = (cm.BoolResult)(cm.U32ToBool((uint32)(result0))) + result = (cm.BoolResult)((bool)(cm.U32ToBool((uint32)(result0)))) return } -//go:wasmimport wasi:http/types@0.2.0 [method]request-options.set-first-byte-timeout -//go:noescape -func wasmimport_RequestOptionsSetFirstByteTimeout(self0 uint32, duration0 uint32, duration1 uint64) (result0 uint32) - // ResponseOutparam represents the imported resource "wasi:http/types@0.2.0#response-outparam". // // Represents the ability to send an HTTP Response. @@ -1540,10 +1519,6 @@ func (self ResponseOutparam) ResourceDrop() { return } -//go:wasmimport wasi:http/types@0.2.0 [resource-drop]response-outparam -//go:noescape -func wasmimport_ResponseOutparamResourceDrop(self0 uint32) - // ResponseOutparamSet represents the imported static function "set". // // Set the value of the `response-outparam` to either send a response, @@ -1567,10 +1542,6 @@ func ResponseOutparamSet(param ResponseOutparam, response cm.Result[ErrorCodeSha return } -//go:wasmimport wasi:http/types@0.2.0 [static]response-outparam.set -//go:noescape -func wasmimport_ResponseOutparamSet(param0 uint32, response0 uint32, response1 uint32, response2 uint32, response3 uint64, response4 uint32, response5 uint32, response6 uint32, response7 uint32) - // StatusCode represents the u16 "wasi:http/types@0.2.0#status-code". // // This type corresponds to the HTTP standard Status Code. @@ -1596,10 +1567,6 @@ func (self IncomingResponse) ResourceDrop() { return } -//go:wasmimport wasi:http/types@0.2.0 [resource-drop]incoming-response -//go:noescape -func wasmimport_IncomingResponseResourceDrop(self0 uint32) - // Consume represents the imported method "consume". // // Returns the incoming body. May be called at most once. Returns error @@ -1614,10 +1581,6 @@ func (self IncomingResponse) Consume() (result cm.Result[IncomingBody, IncomingB return } -//go:wasmimport wasi:http/types@0.2.0 [method]incoming-response.consume -//go:noescape -func wasmimport_IncomingResponseConsume(self0 uint32, result *cm.Result[IncomingBody, IncomingBody, struct{}]) - // Headers represents the imported method "headers". // // Returns the headers from the incoming response. @@ -1631,17 +1594,13 @@ func wasmimport_IncomingResponseConsume(self0 uint32, result *cm.Result[Incoming // headers: func() -> headers // //go:nosplit -func (self IncomingResponse) Headers() (result Fields) { +func (self IncomingResponse) Headers() (result Headers) { self0 := cm.Reinterpret[uint32](self) result0 := wasmimport_IncomingResponseHeaders((uint32)(self0)) - result = cm.Reinterpret[Fields]((uint32)(result0)) + result = cm.Reinterpret[Headers]((uint32)(result0)) return } -//go:wasmimport wasi:http/types@0.2.0 [method]incoming-response.headers -//go:noescape -func wasmimport_IncomingResponseHeaders(self0 uint32) (result0 uint32) - // Status represents the imported method "status". // // Returns the status code from the incoming response. @@ -1656,10 +1615,6 @@ func (self IncomingResponse) Status() (result StatusCode) { return } -//go:wasmimport wasi:http/types@0.2.0 [method]incoming-response.status -//go:noescape -func wasmimport_IncomingResponseStatus(self0 uint32) (result0 uint32) - // IncomingBody represents the imported resource "wasi:http/types@0.2.0#incoming-body". // // Represents an incoming HTTP Request or Response's Body. @@ -1685,10 +1640,6 @@ func (self IncomingBody) ResourceDrop() { return } -//go:wasmimport wasi:http/types@0.2.0 [resource-drop]incoming-body -//go:noescape -func wasmimport_IncomingBodyResourceDrop(self0 uint32) - // IncomingBodyFinish represents the imported static function "finish". // // Takes ownership of `incoming-body`, and returns a `future-trailers`. @@ -1704,10 +1655,6 @@ func IncomingBodyFinish(this IncomingBody) (result FutureTrailers) { return } -//go:wasmimport wasi:http/types@0.2.0 [static]incoming-body.finish -//go:noescape -func wasmimport_IncomingBodyFinish(this0 uint32) (result0 uint32) - // Stream represents the imported method "stream". // // Returns the contents of the body, as a stream of bytes. @@ -1729,16 +1676,12 @@ func wasmimport_IncomingBodyFinish(this0 uint32) (result0 uint32) // %stream: func() -> result // //go:nosplit -func (self IncomingBody) Stream() (result cm.Result[streams.InputStream, streams.InputStream, struct{}]) { +func (self IncomingBody) Stream() (result cm.Result[InputStream, InputStream, struct{}]) { self0 := cm.Reinterpret[uint32](self) wasmimport_IncomingBodyStream((uint32)(self0), &result) return } -//go:wasmimport wasi:http/types@0.2.0 [method]incoming-body.stream -//go:noescape -func wasmimport_IncomingBodyStream(self0 uint32, result *cm.Result[streams.InputStream, streams.InputStream, struct{}]) - // FutureTrailers represents the imported resource "wasi:http/types@0.2.0#future-trailers". // // Represents a future which may eventaully return trailers, or an error. @@ -1761,10 +1704,6 @@ func (self FutureTrailers) ResourceDrop() { return } -//go:wasmimport wasi:http/types@0.2.0 [resource-drop]future-trailers -//go:noescape -func wasmimport_FutureTrailersResourceDrop(self0 uint32) - // Get represents the imported method "get". // // Returns the contents of the trailers, or an error which occured, @@ -1790,16 +1729,12 @@ func wasmimport_FutureTrailersResourceDrop(self0 uint32) // get: func() -> option, error-code>>> // //go:nosplit -func (self FutureTrailers) Get() (result cm.Option[cm.Result[cm.Result[ErrorCodeShape, cm.Option[Fields], ErrorCode], cm.Result[ErrorCodeShape, cm.Option[Fields], ErrorCode], struct{}]]) { +func (self FutureTrailers) Get() (result cm.Option[cm.Result[cm.Result[ErrorCodeShape, cm.Option[Trailers], ErrorCode], cm.Result[ErrorCodeShape, cm.Option[Trailers], ErrorCode], struct{}]]) { self0 := cm.Reinterpret[uint32](self) wasmimport_FutureTrailersGet((uint32)(self0), &result) return } -//go:wasmimport wasi:http/types@0.2.0 [method]future-trailers.get -//go:noescape -func wasmimport_FutureTrailersGet(self0 uint32, result *cm.Option[cm.Result[cm.Result[ErrorCodeShape, cm.Option[Fields], ErrorCode], cm.Result[ErrorCodeShape, cm.Option[Fields], ErrorCode], struct{}]]) - // Subscribe represents the imported method "subscribe". // // Returns a pollable which becomes ready when either the trailers have @@ -1809,17 +1744,13 @@ func wasmimport_FutureTrailersGet(self0 uint32, result *cm.Option[cm.Result[cm.R // subscribe: func() -> pollable // //go:nosplit -func (self FutureTrailers) Subscribe() (result poll.Pollable) { +func (self FutureTrailers) Subscribe() (result Pollable) { self0 := cm.Reinterpret[uint32](self) result0 := wasmimport_FutureTrailersSubscribe((uint32)(self0)) - result = cm.Reinterpret[poll.Pollable]((uint32)(result0)) + result = cm.Reinterpret[Pollable]((uint32)(result0)) return } -//go:wasmimport wasi:http/types@0.2.0 [method]future-trailers.subscribe -//go:noescape -func wasmimport_FutureTrailersSubscribe(self0 uint32) (result0 uint32) - // OutgoingResponse represents the imported resource "wasi:http/types@0.2.0#outgoing-response". // // Represents an outgoing HTTP Response. @@ -1838,10 +1769,6 @@ func (self OutgoingResponse) ResourceDrop() { return } -//go:wasmimport wasi:http/types@0.2.0 [resource-drop]outgoing-response -//go:noescape -func wasmimport_OutgoingResponseResourceDrop(self0 uint32) - // NewOutgoingResponse represents the imported constructor for resource "outgoing-response". // // Construct an `outgoing-response`, with a default `status-code` of `200`. @@ -1853,17 +1780,13 @@ func wasmimport_OutgoingResponseResourceDrop(self0 uint32) // constructor(headers: headers) // //go:nosplit -func NewOutgoingResponse(headers Fields) (result OutgoingResponse) { +func NewOutgoingResponse(headers Headers) (result OutgoingResponse) { headers0 := cm.Reinterpret[uint32](headers) result0 := wasmimport_NewOutgoingResponse((uint32)(headers0)) result = cm.Reinterpret[OutgoingResponse]((uint32)(result0)) return } -//go:wasmimport wasi:http/types@0.2.0 [constructor]outgoing-response -//go:noescape -func wasmimport_NewOutgoingResponse(headers0 uint32) (result0 uint32) - // Body represents the imported method "body". // // Returns the resource corresponding to the outgoing Body for this Response. @@ -1881,10 +1804,6 @@ func (self OutgoingResponse) Body() (result cm.Result[OutgoingBody, OutgoingBody return } -//go:wasmimport wasi:http/types@0.2.0 [method]outgoing-response.body -//go:noescape -func wasmimport_OutgoingResponseBody(self0 uint32, result *cm.Result[OutgoingBody, OutgoingBody, struct{}]) - // Headers represents the imported method "headers". // // Get the headers associated with the Request. @@ -1899,17 +1818,13 @@ func wasmimport_OutgoingResponseBody(self0 uint32, result *cm.Result[OutgoingBod // headers: func() -> headers // //go:nosplit -func (self OutgoingResponse) Headers() (result Fields) { +func (self OutgoingResponse) Headers() (result Headers) { self0 := cm.Reinterpret[uint32](self) result0 := wasmimport_OutgoingResponseHeaders((uint32)(self0)) - result = cm.Reinterpret[Fields]((uint32)(result0)) + result = cm.Reinterpret[Headers]((uint32)(result0)) return } -//go:wasmimport wasi:http/types@0.2.0 [method]outgoing-response.headers -//go:noescape -func wasmimport_OutgoingResponseHeaders(self0 uint32) (result0 uint32) - // SetStatusCode represents the imported method "set-status-code". // // Set the HTTP Status Code for the Response. Fails if the status-code @@ -1922,14 +1837,10 @@ func (self OutgoingResponse) SetStatusCode(statusCode StatusCode) (result cm.Boo self0 := cm.Reinterpret[uint32](self) statusCode0 := (uint32)(statusCode) result0 := wasmimport_OutgoingResponseSetStatusCode((uint32)(self0), (uint32)(statusCode0)) - result = (cm.BoolResult)(cm.U32ToBool((uint32)(result0))) + result = (cm.BoolResult)((bool)(cm.U32ToBool((uint32)(result0)))) return } -//go:wasmimport wasi:http/types@0.2.0 [method]outgoing-response.set-status-code -//go:noescape -func wasmimport_OutgoingResponseSetStatusCode(self0 uint32, statusCode0 uint32) (result0 uint32) - // StatusCode represents the imported method "status-code". // // Get the HTTP Status Code for the Response. @@ -1944,10 +1855,6 @@ func (self OutgoingResponse) StatusCode() (result StatusCode) { return } -//go:wasmimport wasi:http/types@0.2.0 [method]outgoing-response.status-code -//go:noescape -func wasmimport_OutgoingResponseStatusCode(self0 uint32) (result0 uint32) - // OutgoingBody represents the imported resource "wasi:http/types@0.2.0#outgoing-body". // // Represents an outgoing HTTP Request or Response's Body. @@ -1981,10 +1888,6 @@ func (self OutgoingBody) ResourceDrop() { return } -//go:wasmimport wasi:http/types@0.2.0 [resource-drop]outgoing-body -//go:noescape -func wasmimport_OutgoingBodyResourceDrop(self0 uint32) - // OutgoingBodyFinish represents the imported static function "finish". // // Finalize an outgoing body, optionally providing trailers. This must be @@ -2001,17 +1904,13 @@ func wasmimport_OutgoingBodyResourceDrop(self0 uint32) // error-code> // //go:nosplit -func OutgoingBodyFinish(this OutgoingBody, trailers cm.Option[Fields]) (result cm.Result[ErrorCode, struct{}, ErrorCode]) { +func OutgoingBodyFinish(this OutgoingBody, trailers cm.Option[Trailers]) (result cm.Result[ErrorCode, struct{}, ErrorCode]) { this0 := cm.Reinterpret[uint32](this) trailers0, trailers1 := lower_OptionTrailers(trailers) wasmimport_OutgoingBodyFinish((uint32)(this0), (uint32)(trailers0), (uint32)(trailers1), &result) return } -//go:wasmimport wasi:http/types@0.2.0 [static]outgoing-body.finish -//go:noescape -func wasmimport_OutgoingBodyFinish(this0 uint32, trailers0 uint32, trailers1 uint32, result *cm.Result[ErrorCode, struct{}, ErrorCode]) - // Write represents the imported method "write". // // Returns a stream for writing the body contents. @@ -2027,16 +1926,12 @@ func wasmimport_OutgoingBodyFinish(this0 uint32, trailers0 uint32, trailers1 uin // write: func() -> result // //go:nosplit -func (self OutgoingBody) Write() (result cm.Result[streams.OutputStream, streams.OutputStream, struct{}]) { +func (self OutgoingBody) Write() (result cm.Result[OutputStream, OutputStream, struct{}]) { self0 := cm.Reinterpret[uint32](self) wasmimport_OutgoingBodyWrite((uint32)(self0), &result) return } -//go:wasmimport wasi:http/types@0.2.0 [method]outgoing-body.write -//go:noescape -func wasmimport_OutgoingBodyWrite(self0 uint32, result *cm.Result[streams.OutputStream, streams.OutputStream, struct{}]) - // FutureIncomingResponse represents the imported resource "wasi:http/types@0.2.0#future-incoming-response". // // Represents a future which may eventaully return an incoming HTTP @@ -2059,10 +1954,6 @@ func (self FutureIncomingResponse) ResourceDrop() { return } -//go:wasmimport wasi:http/types@0.2.0 [resource-drop]future-incoming-response -//go:noescape -func wasmimport_FutureIncomingResponseResourceDrop(self0 uint32) - // Get represents the imported method "get". // // Returns the incoming HTTP Response, or an error, once one is ready. @@ -2089,10 +1980,6 @@ func (self FutureIncomingResponse) Get() (result cm.Option[cm.Result[cm.Result[E return } -//go:wasmimport wasi:http/types@0.2.0 [method]future-incoming-response.get -//go:noescape -func wasmimport_FutureIncomingResponseGet(self0 uint32, result *cm.Option[cm.Result[cm.Result[ErrorCodeShape, IncomingResponse, ErrorCode], cm.Result[ErrorCodeShape, IncomingResponse, ErrorCode], struct{}]]) - // Subscribe represents the imported method "subscribe". // // Returns a pollable which becomes ready when either the Response has @@ -2102,17 +1989,13 @@ func wasmimport_FutureIncomingResponseGet(self0 uint32, result *cm.Option[cm.Res // subscribe: func() -> pollable // //go:nosplit -func (self FutureIncomingResponse) Subscribe() (result poll.Pollable) { +func (self FutureIncomingResponse) Subscribe() (result Pollable) { self0 := cm.Reinterpret[uint32](self) result0 := wasmimport_FutureIncomingResponseSubscribe((uint32)(self0)) - result = cm.Reinterpret[poll.Pollable]((uint32)(result0)) + result = cm.Reinterpret[Pollable]((uint32)(result0)) return } -//go:wasmimport wasi:http/types@0.2.0 [method]future-incoming-response.subscribe -//go:noescape -func wasmimport_FutureIncomingResponseSubscribe(self0 uint32) (result0 uint32) - // HTTPErrorCode represents the imported function "http-error-code". // // Attempts to extract a http-related `error` from the wasi:io `error` @@ -2130,12 +2013,8 @@ func wasmimport_FutureIncomingResponseSubscribe(self0 uint32) (result0 uint32) // http-error-code: func(err: borrow) -> option // //go:nosplit -func HTTPErrorCode(err ioerror.Error) (result cm.Option[ErrorCode]) { +func HTTPErrorCode(err IOError) (result cm.Option[ErrorCode]) { err0 := cm.Reinterpret[uint32](err) wasmimport_HTTPErrorCode((uint32)(err0), &result) return } - -//go:wasmimport wasi:http/types@0.2.0 http-error-code -//go:noescape -func wasmimport_HTTPErrorCode(err0 uint32, result *cm.Option[ErrorCode]) diff --git a/lib/wasi/io/error/error.wasm.go b/lib/wasi/io/error/error.wasm.go new file mode 100755 index 0000000..e254b5d --- /dev/null +++ b/lib/wasi/io/error/error.wasm.go @@ -0,0 +1,13 @@ +// Code generated by wit-bindgen-go. DO NOT EDIT. + +package ioerror + +// This file contains wasmimport and wasmexport declarations for "wasi:io@0.2.0". + +//go:wasmimport wasi:io/error@0.2.0 [resource-drop]error +//go:noescape +func wasmimport_ErrorResourceDrop(self0 uint32) + +//go:wasmimport wasi:io/error@0.2.0 [method]error.to-debug-string +//go:noescape +func wasmimport_ErrorToDebugString(self0 uint32, result *string) diff --git a/lib/wasi/io/error/error.wit.go b/lib/wasi/io/error/error.wit.go index 96d18cf..24bad43 100644 --- a/lib/wasi/io/error/error.wit.go +++ b/lib/wasi/io/error/error.wit.go @@ -4,7 +4,7 @@ package ioerror import ( - "github.com/ydnar/wasm-tools-go/cm" + "go.bytecodealliance.org/cm" ) // Error represents the imported resource "wasi:io/error@0.2.0#error". @@ -43,10 +43,6 @@ func (self Error) ResourceDrop() { return } -//go:wasmimport wasi:io/error@0.2.0 [resource-drop]error -//go:noescape -func wasmimport_ErrorResourceDrop(self0 uint32) - // ToDebugString represents the imported method "to-debug-string". // // Returns a string that is suitable to assist humans in debugging @@ -65,7 +61,3 @@ func (self Error) ToDebugString() (result string) { wasmimport_ErrorToDebugString((uint32)(self0), &result) return } - -//go:wasmimport wasi:io/error@0.2.0 [method]error.to-debug-string -//go:noescape -func wasmimport_ErrorToDebugString(self0 uint32, result *string) diff --git a/lib/wasi/io/poll/poll.wasm.go b/lib/wasi/io/poll/poll.wasm.go new file mode 100755 index 0000000..f7c55c3 --- /dev/null +++ b/lib/wasi/io/poll/poll.wasm.go @@ -0,0 +1,25 @@ +// Code generated by wit-bindgen-go. DO NOT EDIT. + +package poll + +import ( + "go.bytecodealliance.org/cm" +) + +// This file contains wasmimport and wasmexport declarations for "wasi:io@0.2.0". + +//go:wasmimport wasi:io/poll@0.2.0 [resource-drop]pollable +//go:noescape +func wasmimport_PollableResourceDrop(self0 uint32) + +//go:wasmimport wasi:io/poll@0.2.0 [method]pollable.block +//go:noescape +func wasmimport_PollableBlock(self0 uint32) + +//go:wasmimport wasi:io/poll@0.2.0 [method]pollable.ready +//go:noescape +func wasmimport_PollableReady(self0 uint32) (result0 uint32) + +//go:wasmimport wasi:io/poll@0.2.0 poll +//go:noescape +func wasmimport_Poll(in0 *Pollable, in1 uint32, result *cm.List[uint32]) diff --git a/lib/wasi/io/poll/poll.wit.go b/lib/wasi/io/poll/poll.wit.go index ba22e54..10c0033 100644 --- a/lib/wasi/io/poll/poll.wit.go +++ b/lib/wasi/io/poll/poll.wit.go @@ -7,7 +7,7 @@ package poll import ( - "github.com/ydnar/wasm-tools-go/cm" + "go.bytecodealliance.org/cm" ) // Pollable represents the imported resource "wasi:io/poll@0.2.0#pollable". @@ -28,10 +28,6 @@ func (self Pollable) ResourceDrop() { return } -//go:wasmimport wasi:io/poll@0.2.0 [resource-drop]pollable -//go:noescape -func wasmimport_PollableResourceDrop(self0 uint32) - // Block represents the imported method "block". // // `block` returns immediately if the pollable is ready, and otherwise @@ -49,10 +45,6 @@ func (self Pollable) Block() { return } -//go:wasmimport wasi:io/poll@0.2.0 [method]pollable.block -//go:noescape -func wasmimport_PollableBlock(self0 uint32) - // Ready represents the imported method "ready". // // Return the readiness of a pollable. This function never blocks. @@ -65,14 +57,10 @@ func wasmimport_PollableBlock(self0 uint32) func (self Pollable) Ready() (result bool) { self0 := cm.Reinterpret[uint32](self) result0 := wasmimport_PollableReady((uint32)(self0)) - result = cm.U32ToBool((uint32)(result0)) + result = (bool)(cm.U32ToBool((uint32)(result0))) return } -//go:wasmimport wasi:io/poll@0.2.0 [method]pollable.ready -//go:noescape -func wasmimport_PollableReady(self0 uint32) (result0 uint32) - // Poll represents the imported function "poll". // // Poll for completion on a set of pollables. @@ -102,7 +90,3 @@ func Poll(in cm.List[Pollable]) (result cm.List[uint32]) { wasmimport_Poll((*Pollable)(in0), (uint32)(in1), &result) return } - -//go:wasmimport wasi:io/poll@0.2.0 poll -//go:noescape -func wasmimport_Poll(in0 *Pollable, in1 uint32, result *cm.List[uint32]) diff --git a/lib/wasi/io/streams/streams.wasm.go b/lib/wasi/io/streams/streams.wasm.go new file mode 100755 index 0000000..eec5664 --- /dev/null +++ b/lib/wasi/io/streams/streams.wasm.go @@ -0,0 +1,77 @@ +// Code generated by wit-bindgen-go. DO NOT EDIT. + +package streams + +import ( + "go.bytecodealliance.org/cm" +) + +// This file contains wasmimport and wasmexport declarations for "wasi:io@0.2.0". + +//go:wasmimport wasi:io/streams@0.2.0 [resource-drop]input-stream +//go:noescape +func wasmimport_InputStreamResourceDrop(self0 uint32) + +//go:wasmimport wasi:io/streams@0.2.0 [method]input-stream.blocking-read +//go:noescape +func wasmimport_InputStreamBlockingRead(self0 uint32, len0 uint64, result *cm.Result[cm.List[uint8], cm.List[uint8], StreamError]) + +//go:wasmimport wasi:io/streams@0.2.0 [method]input-stream.blocking-skip +//go:noescape +func wasmimport_InputStreamBlockingSkip(self0 uint32, len0 uint64, result *cm.Result[uint64, uint64, StreamError]) + +//go:wasmimport wasi:io/streams@0.2.0 [method]input-stream.read +//go:noescape +func wasmimport_InputStreamRead(self0 uint32, len0 uint64, result *cm.Result[cm.List[uint8], cm.List[uint8], StreamError]) + +//go:wasmimport wasi:io/streams@0.2.0 [method]input-stream.skip +//go:noescape +func wasmimport_InputStreamSkip(self0 uint32, len0 uint64, result *cm.Result[uint64, uint64, StreamError]) + +//go:wasmimport wasi:io/streams@0.2.0 [method]input-stream.subscribe +//go:noescape +func wasmimport_InputStreamSubscribe(self0 uint32) (result0 uint32) + +//go:wasmimport wasi:io/streams@0.2.0 [resource-drop]output-stream +//go:noescape +func wasmimport_OutputStreamResourceDrop(self0 uint32) + +//go:wasmimport wasi:io/streams@0.2.0 [method]output-stream.blocking-flush +//go:noescape +func wasmimport_OutputStreamBlockingFlush(self0 uint32, result *cm.Result[StreamError, struct{}, StreamError]) + +//go:wasmimport wasi:io/streams@0.2.0 [method]output-stream.blocking-splice +//go:noescape +func wasmimport_OutputStreamBlockingSplice(self0 uint32, src0 uint32, len0 uint64, result *cm.Result[uint64, uint64, StreamError]) + +//go:wasmimport wasi:io/streams@0.2.0 [method]output-stream.blocking-write-and-flush +//go:noescape +func wasmimport_OutputStreamBlockingWriteAndFlush(self0 uint32, contents0 *uint8, contents1 uint32, result *cm.Result[StreamError, struct{}, StreamError]) + +//go:wasmimport wasi:io/streams@0.2.0 [method]output-stream.blocking-write-zeroes-and-flush +//go:noescape +func wasmimport_OutputStreamBlockingWriteZeroesAndFlush(self0 uint32, len0 uint64, result *cm.Result[StreamError, struct{}, StreamError]) + +//go:wasmimport wasi:io/streams@0.2.0 [method]output-stream.check-write +//go:noescape +func wasmimport_OutputStreamCheckWrite(self0 uint32, result *cm.Result[uint64, uint64, StreamError]) + +//go:wasmimport wasi:io/streams@0.2.0 [method]output-stream.flush +//go:noescape +func wasmimport_OutputStreamFlush(self0 uint32, result *cm.Result[StreamError, struct{}, StreamError]) + +//go:wasmimport wasi:io/streams@0.2.0 [method]output-stream.splice +//go:noescape +func wasmimport_OutputStreamSplice(self0 uint32, src0 uint32, len0 uint64, result *cm.Result[uint64, uint64, StreamError]) + +//go:wasmimport wasi:io/streams@0.2.0 [method]output-stream.subscribe +//go:noescape +func wasmimport_OutputStreamSubscribe(self0 uint32) (result0 uint32) + +//go:wasmimport wasi:io/streams@0.2.0 [method]output-stream.write +//go:noescape +func wasmimport_OutputStreamWrite(self0 uint32, contents0 *uint8, contents1 uint32, result *cm.Result[StreamError, struct{}, StreamError]) + +//go:wasmimport wasi:io/streams@0.2.0 [method]output-stream.write-zeroes +//go:noescape +func wasmimport_OutputStreamWriteZeroes(self0 uint32, len0 uint64, result *cm.Result[StreamError, struct{}, StreamError]) diff --git a/lib/wasi/io/streams/streams.wit.go b/lib/wasi/io/streams/streams.wit.go index 2e116d9..af469f2 100644 --- a/lib/wasi/io/streams/streams.wit.go +++ b/lib/wasi/io/streams/streams.wit.go @@ -12,9 +12,19 @@ package streams import ( ioerror "github.com/dev-wasm/dev-wasm-go/lib/wasi/io/error" "github.com/dev-wasm/dev-wasm-go/lib/wasi/io/poll" - "github.com/ydnar/wasm-tools-go/cm" + "go.bytecodealliance.org/cm" ) +// Error represents the imported type alias "wasi:io/streams@0.2.0#error". +// +// See [ioerror.Error] for more information. +type Error = ioerror.Error + +// Pollable represents the imported type alias "wasi:io/streams@0.2.0#pollable". +// +// See [poll.Pollable] for more information. +type Pollable = poll.Pollable + // StreamError represents the imported variant "wasi:io/streams@0.2.0#stream-error". // // An error for input-stream and output-stream operations. @@ -23,20 +33,20 @@ import ( // last-operation-failed(error), // closed, // } -type StreamError cm.Variant[uint8, ioerror.Error, ioerror.Error] +type StreamError cm.Variant[uint8, Error, Error] // StreamErrorLastOperationFailed returns a [StreamError] of case "last-operation-failed". // // The last operation (a write or flush) failed before completion. // // More information is available in the `error` payload. -func StreamErrorLastOperationFailed(data ioerror.Error) StreamError { +func StreamErrorLastOperationFailed(data Error) StreamError { return cm.New[StreamError](0, data) } -// LastOperationFailed returns a non-nil *[ioerror.Error] if [StreamError] represents the variant case "last-operation-failed". -func (self *StreamError) LastOperationFailed() *ioerror.Error { - return cm.Case[ioerror.Error](self, 0) +// LastOperationFailed returns a non-nil *[Error] if [StreamError] represents the variant case "last-operation-failed". +func (self *StreamError) LastOperationFailed() *Error { + return cm.Case[Error](self, 0) } // StreamErrorClosed returns a [StreamError] of case "closed". @@ -54,6 +64,16 @@ func (self *StreamError) Closed() bool { return self.Tag() == 1 } +var _StreamErrorStrings = [2]string{ + "last-operation-failed", + "closed", +} + +// String implements [fmt.Stringer], returning the variant case name of v. +func (v StreamError) String() string { + return _StreamErrorStrings[v.Tag()] +} + // InputStream represents the imported resource "wasi:io/streams@0.2.0#input-stream". // // An input bytestream. @@ -79,10 +99,6 @@ func (self InputStream) ResourceDrop() { return } -//go:wasmimport wasi:io/streams@0.2.0 [resource-drop]input-stream -//go:noescape -func wasmimport_InputStreamResourceDrop(self0 uint32) - // BlockingRead represents the imported method "blocking-read". // // Read bytes from a stream, after blocking until at least one byte can @@ -98,10 +114,6 @@ func (self InputStream) BlockingRead(len_ uint64) (result cm.Result[cm.List[uint return } -//go:wasmimport wasi:io/streams@0.2.0 [method]input-stream.blocking-read -//go:noescape -func wasmimport_InputStreamBlockingRead(self0 uint32, len0 uint64, result *cm.Result[cm.List[uint8], cm.List[uint8], StreamError]) - // BlockingSkip represents the imported method "blocking-skip". // // Skip bytes from a stream, after blocking until at least one byte @@ -117,10 +129,6 @@ func (self InputStream) BlockingSkip(len_ uint64) (result cm.Result[uint64, uint return } -//go:wasmimport wasi:io/streams@0.2.0 [method]input-stream.blocking-skip -//go:noescape -func wasmimport_InputStreamBlockingSkip(self0 uint32, len0 uint64, result *cm.Result[uint64, uint64, StreamError]) - // Read represents the imported method "read". // // Perform a non-blocking read from the stream. @@ -160,10 +168,6 @@ func (self InputStream) Read(len_ uint64) (result cm.Result[cm.List[uint8], cm.L return } -//go:wasmimport wasi:io/streams@0.2.0 [method]input-stream.read -//go:noescape -func wasmimport_InputStreamRead(self0 uint32, len0 uint64, result *cm.Result[cm.List[uint8], cm.List[uint8], StreamError]) - // Skip represents the imported method "skip". // // Skip bytes from a stream. Returns number of bytes skipped. @@ -181,10 +185,6 @@ func (self InputStream) Skip(len_ uint64) (result cm.Result[uint64, uint64, Stre return } -//go:wasmimport wasi:io/streams@0.2.0 [method]input-stream.skip -//go:noescape -func wasmimport_InputStreamSkip(self0 uint32, len0 uint64, result *cm.Result[uint64, uint64, StreamError]) - // Subscribe represents the imported method "subscribe". // // Create a `pollable` which will resolve once either the specified stream @@ -197,17 +197,13 @@ func wasmimport_InputStreamSkip(self0 uint32, len0 uint64, result *cm.Result[uin // subscribe: func() -> pollable // //go:nosplit -func (self InputStream) Subscribe() (result poll.Pollable) { +func (self InputStream) Subscribe() (result Pollable) { self0 := cm.Reinterpret[uint32](self) result0 := wasmimport_InputStreamSubscribe((uint32)(self0)) - result = cm.Reinterpret[poll.Pollable]((uint32)(result0)) + result = cm.Reinterpret[Pollable]((uint32)(result0)) return } -//go:wasmimport wasi:io/streams@0.2.0 [method]input-stream.subscribe -//go:noescape -func wasmimport_InputStreamSubscribe(self0 uint32) (result0 uint32) - // OutputStream represents the imported resource "wasi:io/streams@0.2.0#output-stream". // // An output bytestream. @@ -233,10 +229,6 @@ func (self OutputStream) ResourceDrop() { return } -//go:wasmimport wasi:io/streams@0.2.0 [resource-drop]output-stream -//go:noescape -func wasmimport_OutputStreamResourceDrop(self0 uint32) - // BlockingFlush represents the imported method "blocking-flush". // // Request to flush buffered output, and block until flush completes @@ -251,10 +243,6 @@ func (self OutputStream) BlockingFlush() (result cm.Result[StreamError, struct{} return } -//go:wasmimport wasi:io/streams@0.2.0 [method]output-stream.blocking-flush -//go:noescape -func wasmimport_OutputStreamBlockingFlush(self0 uint32, result *cm.Result[StreamError, struct{}, StreamError]) - // BlockingSplice represents the imported method "blocking-splice". // // Read from one stream and write to another, with blocking. @@ -274,10 +262,6 @@ func (self OutputStream) BlockingSplice(src InputStream, len_ uint64) (result cm return } -//go:wasmimport wasi:io/streams@0.2.0 [method]output-stream.blocking-splice -//go:noescape -func wasmimport_OutputStreamBlockingSplice(self0 uint32, src0 uint32, len0 uint64, result *cm.Result[uint64, uint64, StreamError]) - // BlockingWriteAndFlush represents the imported method "blocking-write-and-flush". // // Perform a write of up to 4096 bytes, and then flush the stream. Block @@ -289,13 +273,13 @@ func wasmimport_OutputStreamBlockingSplice(self0 uint32, src0 uint32, len0 uint6 // // let pollable = this.subscribe(); // while !contents.is_empty() { -// // Wait for the stream to become writable -// pollable.block(); -// let Ok(n) = this.check-write(); // eliding error handling -// let len = min(n, contents.len()); -// let (chunk, rest) = contents.split_at(len); -// this.write(chunk ); // eliding error handling -// contents = rest; +// // Wait for the stream to become writable +// pollable.block(); +// let Ok(n) = this.check-write(); // eliding error handling +// let len = min(n, contents.len()); +// let (chunk, rest) = contents.split_at(len); +// this.write(chunk ); // eliding error handling +// contents = rest; // } // this.flush(); // // Wait for completion of `flush` @@ -313,10 +297,6 @@ func (self OutputStream) BlockingWriteAndFlush(contents cm.List[uint8]) (result return } -//go:wasmimport wasi:io/streams@0.2.0 [method]output-stream.blocking-write-and-flush -//go:noescape -func wasmimport_OutputStreamBlockingWriteAndFlush(self0 uint32, contents0 *uint8, contents1 uint32, result *cm.Result[StreamError, struct{}, StreamError]) - // BlockingWriteZeroesAndFlush represents the imported method "blocking-write-zeroes-and-flush". // // Perform a write of up to 4096 zeroes, and then flush the stream. @@ -329,12 +309,12 @@ func wasmimport_OutputStreamBlockingWriteAndFlush(self0 uint32, contents0 *uint8 // // let pollable = this.subscribe(); // while num_zeroes != 0 { -// // Wait for the stream to become writable -// pollable.block(); -// let Ok(n) = this.check-write(); // eliding error handling -// let len = min(n, num_zeroes); -// this.write-zeroes(len); // eliding error handling -// num_zeroes -= len; +// // Wait for the stream to become writable +// pollable.block(); +// let Ok(n) = this.check-write(); // eliding error handling +// let len = min(n, num_zeroes); +// this.write-zeroes(len); // eliding error handling +// num_zeroes -= len; // } // this.flush(); // // Wait for completion of `flush` @@ -352,10 +332,6 @@ func (self OutputStream) BlockingWriteZeroesAndFlush(len_ uint64) (result cm.Res return } -//go:wasmimport wasi:io/streams@0.2.0 [method]output-stream.blocking-write-zeroes-and-flush -//go:noescape -func wasmimport_OutputStreamBlockingWriteZeroesAndFlush(self0 uint32, len0 uint64, result *cm.Result[StreamError, struct{}, StreamError]) - // CheckWrite represents the imported method "check-write". // // Check readiness for writing. This function never blocks. @@ -377,10 +353,6 @@ func (self OutputStream) CheckWrite() (result cm.Result[uint64, uint64, StreamEr return } -//go:wasmimport wasi:io/streams@0.2.0 [method]output-stream.check-write -//go:noescape -func wasmimport_OutputStreamCheckWrite(self0 uint32, result *cm.Result[uint64, uint64, StreamError]) - // Flush represents the imported method "flush". // // Request to flush buffered output. This function never blocks. @@ -403,10 +375,6 @@ func (self OutputStream) Flush() (result cm.Result[StreamError, struct{}, Stream return } -//go:wasmimport wasi:io/streams@0.2.0 [method]output-stream.flush -//go:noescape -func wasmimport_OutputStreamFlush(self0 uint32, result *cm.Result[StreamError, struct{}, StreamError]) - // Splice represents the imported method "splice". // // Read from one stream and write to another. @@ -434,10 +402,6 @@ func (self OutputStream) Splice(src InputStream, len_ uint64) (result cm.Result[ return } -//go:wasmimport wasi:io/streams@0.2.0 [method]output-stream.splice -//go:noescape -func wasmimport_OutputStreamSplice(self0 uint32, src0 uint32, len0 uint64, result *cm.Result[uint64, uint64, StreamError]) - // Subscribe represents the imported method "subscribe". // // Create a `pollable` which will resolve once the output-stream @@ -454,17 +418,13 @@ func wasmimport_OutputStreamSplice(self0 uint32, src0 uint32, len0 uint64, resul // subscribe: func() -> pollable // //go:nosplit -func (self OutputStream) Subscribe() (result poll.Pollable) { +func (self OutputStream) Subscribe() (result Pollable) { self0 := cm.Reinterpret[uint32](self) result0 := wasmimport_OutputStreamSubscribe((uint32)(self0)) - result = cm.Reinterpret[poll.Pollable]((uint32)(result0)) + result = cm.Reinterpret[Pollable]((uint32)(result0)) return } -//go:wasmimport wasi:io/streams@0.2.0 [method]output-stream.subscribe -//go:noescape -func wasmimport_OutputStreamSubscribe(self0 uint32) (result0 uint32) - // Write represents the imported method "write". // // Perform a write. This function never blocks. @@ -491,10 +451,6 @@ func (self OutputStream) Write(contents cm.List[uint8]) (result cm.Result[Stream return } -//go:wasmimport wasi:io/streams@0.2.0 [method]output-stream.write -//go:noescape -func wasmimport_OutputStreamWrite(self0 uint32, contents0 *uint8, contents1 uint32, result *cm.Result[StreamError, struct{}, StreamError]) - // WriteZeroes represents the imported method "write-zeroes". // // Write zeroes to a stream. @@ -513,7 +469,3 @@ func (self OutputStream) WriteZeroes(len_ uint64) (result cm.Result[StreamError, wasmimport_OutputStreamWriteZeroes((uint32)(self0), (uint64)(len0), &result) return } - -//go:wasmimport wasi:io/streams@0.2.0 [method]output-stream.write-zeroes -//go:noescape -func wasmimport_OutputStreamWriteZeroes(self0 uint32, len0 uint64, result *cm.Result[StreamError, struct{}, StreamError]) diff --git a/lib/wasi/random/random/random.wasm.go b/lib/wasi/random/random/random.wasm.go new file mode 100755 index 0000000..9096457 --- /dev/null +++ b/lib/wasi/random/random/random.wasm.go @@ -0,0 +1,17 @@ +// Code generated by wit-bindgen-go. DO NOT EDIT. + +package random + +import ( + "go.bytecodealliance.org/cm" +) + +// This file contains wasmimport and wasmexport declarations for "wasi:random@0.2.0". + +//go:wasmimport wasi:random/random@0.2.0 get-random-bytes +//go:noescape +func wasmimport_GetRandomBytes(len0 uint64, result *cm.List[uint8]) + +//go:wasmimport wasi:random/random@0.2.0 get-random-u64 +//go:noescape +func wasmimport_GetRandomU64() (result0 uint64) diff --git a/lib/wasi/random/random/random.wit.go b/lib/wasi/random/random/random.wit.go index 04b2319..bb90e7e 100644 --- a/lib/wasi/random/random/random.wit.go +++ b/lib/wasi/random/random/random.wit.go @@ -9,7 +9,7 @@ package random import ( - "github.com/ydnar/wasm-tools-go/cm" + "go.bytecodealliance.org/cm" ) // GetRandomBytes represents the imported function "get-random-bytes". @@ -36,10 +36,6 @@ func GetRandomBytes(len_ uint64) (result cm.List[uint8]) { return } -//go:wasmimport wasi:random/random@0.2.0 get-random-bytes -//go:noescape -func wasmimport_GetRandomBytes(len0 uint64, result *cm.List[uint8]) - // GetRandomU64 represents the imported function "get-random-u64". // // Return a cryptographically-secure random or pseudo-random `u64` value. @@ -55,7 +51,3 @@ func GetRandomU64() (result uint64) { result = (uint64)((uint64)(result0)) return } - -//go:wasmimport wasi:random/random@0.2.0 get-random-u64 -//go:noescape -func wasmimport_GetRandomU64() (result0 uint64) diff --git a/webserver/wasi-http/go.mod b/webserver/wasi-http/go.mod index 773c19d..8b42416 100644 --- a/webserver/wasi-http/go.mod +++ b/webserver/wasi-http/go.mod @@ -1,9 +1,9 @@ module github.com/dev-wasm/dev-wasm-go/webserver/wasi-http -go 1.22.0 +go 1.23.0 require github.com/dev-wasm/dev-wasm-go/lib v0.0.0 -require github.com/ydnar/wasm-tools-go v0.1.5 // indirect +require go.bytecodealliance.org/cm v0.1.1-0.20250218151459-e57ac0139b6f // indirect -replace github.com/dev-wasm/dev-wasm-go/lib v0.0.0 => ../../lib +replace github.com/dev-wasm/dev-wasm-go/lib v0.0.0 => ../../lib/ diff --git a/webserver/wasi-http/go.sum b/webserver/wasi-http/go.sum index 37b5115..2129829 100644 --- a/webserver/wasi-http/go.sum +++ b/webserver/wasi-http/go.sum @@ -1,2 +1,2 @@ -github.com/ydnar/wasm-tools-go v0.1.5 h1:ah2WT4gH0IrmN29ZSsjgNC9SPsdXZ+KN+o9uTZqNVSI= -github.com/ydnar/wasm-tools-go v0.1.5/go.mod h1:L3sDi5rbAMJNmMO5cpDRzYYhB0r9xIU0xgpKjwU0Adg= +go.bytecodealliance.org/cm v0.1.1-0.20250218151459-e57ac0139b6f h1:cHJcIruuUZwd7rDdcJHOVotufiO+qPfFwcxb6uCUVSI= +go.bytecodealliance.org/cm v0.1.1-0.20250218151459-e57ac0139b6f/go.mod h1:NZ2UT0DyGhBfpIPOxPMCuG6g1YTR4YF3xweD7mHX5VQ=