aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRandy Reddig <[email protected]>2024-07-08 22:09:47 +0200
committerGitHub <[email protected]>2024-07-08 13:09:47 -0700
commit2d85fc6a6435f3bbdb8edaba6d41e6ec014f57f2 (patch)
tree77ebb35d5044bc54823c24f5a881abfe8b023798
parent5ca3e4a2da72a2cb981b9af061a14c1128870957 (diff)
downloadtinygo-2d85fc6a6435f3bbdb8edaba6d41e6ec014f57f2.tar.gz
tinygo-2d85fc6a6435f3bbdb8edaba6d41e6ec014f57f2.zip
internal/wasi: update to [email protected] (#4326)
* internal/wasi: update to [email protected] See https://github.com/ydnar/wasm-tools-go/releases/tag/v0.1.1 for additional information. * internal/wasi: update to [email protected] * internal/wasi: regenerate with [email protected]
-rw-r--r--src/internal/wasi/cli/v0.2.0/exit/exit.wit.go4
-rw-r--r--src/internal/wasi/cli/v0.2.0/run/run.exports.go2
-rw-r--r--src/internal/wasi/cli/v0.2.0/run/run.wit.go2
-rw-r--r--src/internal/wasi/filesystem/v0.2.0/types/abi.go28
-rw-r--r--src/internal/wasi/filesystem/v0.2.0/types/types.wit.go187
-rw-r--r--src/internal/wasi/io/v0.2.0/streams/abi.go14
-rw-r--r--src/internal/wasi/io/v0.2.0/streams/streams.wit.go54
-rw-r--r--src/internal/wasi/sockets/v0.2.0/ip-name-lookup/abi.go16
-rw-r--r--src/internal/wasi/sockets/v0.2.0/ip-name-lookup/ip-name-lookup.wit.go8
-rw-r--r--src/internal/wasi/sockets/v0.2.0/network/abi.go14
-rw-r--r--src/internal/wasi/sockets/v0.2.0/network/network.wit.go41
-rw-r--r--src/internal/wasi/sockets/v0.2.0/tcp-create-socket/tcp-create-socket.wit.go4
-rw-r--r--src/internal/wasi/sockets/v0.2.0/tcp/abi.go19
-rw-r--r--src/internal/wasi/sockets/v0.2.0/tcp/tcp.wit.go111
-rw-r--r--src/internal/wasi/sockets/v0.2.0/udp-create-socket/udp-create-socket.wit.go4
-rw-r--r--src/internal/wasi/sockets/v0.2.0/udp/abi.go13
-rw-r--r--src/internal/wasi/sockets/v0.2.0/udp/udp.wit.go56
m---------src/vendor/github.com/ydnar/wasm-tools-go0
18 files changed, 400 insertions, 177 deletions
diff --git a/src/internal/wasi/cli/v0.2.0/exit/exit.wit.go b/src/internal/wasi/cli/v0.2.0/exit/exit.wit.go
index 36af67d24..d10b734c6 100644
--- a/src/internal/wasi/cli/v0.2.0/exit/exit.wit.go
+++ b/src/internal/wasi/cli/v0.2.0/exit/exit.wit.go
@@ -16,8 +16,8 @@ import (
// exit: func(status: result)
//
//go:nosplit
-func Exit(status cm.Result) {
- status0 := cm.LowerResult(status)
+func Exit(status cm.BoolResult) {
+ status0 := cm.BoolToU32(status)
wasmimport_Exit((uint32)(status0))
return
}
diff --git a/src/internal/wasi/cli/v0.2.0/run/run.exports.go b/src/internal/wasi/cli/v0.2.0/run/run.exports.go
index 267e75a08..3d0edcc80 100644
--- a/src/internal/wasi/cli/v0.2.0/run/run.exports.go
+++ b/src/internal/wasi/cli/v0.2.0/run/run.exports.go
@@ -15,5 +15,5 @@ var Exports struct {
// Run the program.
//
// run: func() -> result
- Run func() (result cm.Result)
+ Run func() (result cm.BoolResult)
}
diff --git a/src/internal/wasi/cli/v0.2.0/run/run.wit.go b/src/internal/wasi/cli/v0.2.0/run/run.wit.go
index 728d0292a..47e00180c 100644
--- a/src/internal/wasi/cli/v0.2.0/run/run.wit.go
+++ b/src/internal/wasi/cli/v0.2.0/run/run.wit.go
@@ -13,6 +13,6 @@ import (
//export wasi:cli/[email protected]#run
func wasmexport_Run() (result0 uint32) {
result := Exports.Run()
- result0 = cm.LowerResult(result)
+ result0 = cm.BoolToU32(result)
return
}
diff --git a/src/internal/wasi/filesystem/v0.2.0/types/abi.go b/src/internal/wasi/filesystem/v0.2.0/types/abi.go
index 288ef2e22..41f6848ec 100644
--- a/src/internal/wasi/filesystem/v0.2.0/types/abi.go
+++ b/src/internal/wasi/filesystem/v0.2.0/types/abi.go
@@ -7,8 +7,24 @@ package types
import (
"github.com/ydnar/wasm-tools-go/cm"
wallclock "internal/wasi/clocks/v0.2.0/wall-clock"
+ "unsafe"
)
+// DateTimeShape is used for storage in variant or result types.
+type DateTimeShape struct {
+ shape [unsafe.Sizeof(wallclock.DateTime{})]byte
+}
+
+// MetadataHashValueShape is used for storage in variant or result types.
+type MetadataHashValueShape struct {
+ shape [unsafe.Sizeof(MetadataHashValue{})]byte
+}
+
+// TupleListU8BoolShape is used for storage in variant or result types.
+type TupleListU8BoolShape struct {
+ shape [unsafe.Sizeof(cm.Tuple[cm.List[uint8], bool]{})]byte
+}
+
func lower_DateTime(v wallclock.DateTime) (f0 uint64, f1 uint32) {
f0 = (uint64)(v.Seconds)
f1 = (uint32)(v.Nanoseconds)
@@ -16,7 +32,7 @@ func lower_DateTime(v wallclock.DateTime) (f0 uint64, f1 uint32) {
}
func lower_NewTimestamp(v NewTimestamp) (f0 uint32, f1 uint64, f2 uint32) {
- f0 = (uint32)(cm.Tag(&v))
+ f0 = (uint32)(v.Tag())
switch f0 {
case 2: // timestamp
v1, v2 := lower_DateTime(*v.Timestamp())
@@ -25,3 +41,13 @@ func lower_NewTimestamp(v NewTimestamp) (f0 uint32, f1 uint64, f2 uint32) {
}
return
}
+
+// DescriptorStatShape is used for storage in variant or result types.
+type DescriptorStatShape struct {
+ shape [unsafe.Sizeof(DescriptorStat{})]byte
+}
+
+// OptionDirectoryEntryShape is used for storage in variant or result types.
+type OptionDirectoryEntryShape struct {
+ shape [unsafe.Sizeof(cm.Option[DirectoryEntry]{})]byte
+}
diff --git a/src/internal/wasi/filesystem/v0.2.0/types/types.wit.go b/src/internal/wasi/filesystem/v0.2.0/types/types.wit.go
index 387426d1b..226edabd7 100644
--- a/src/internal/wasi/filesystem/v0.2.0/types/types.wit.go
+++ b/src/internal/wasi/filesystem/v0.2.0/types/types.wit.go
@@ -89,6 +89,22 @@ const (
DescriptorTypeSocket
)
+var stringsDescriptorType = [8]string{
+ "unknown",
+ "block-device",
+ "character-device",
+ "directory",
+ "fifo",
+ "symbolic-link",
+ "regular-file",
+ "socket",
+}
+
+// String implements [fmt.Stringer], returning the enum case name of e.
+func (e DescriptorType) String() string {
+ return stringsDescriptorType[e]
+}
+
// DescriptorFlags represents the flags "wasi:filesystem/[email protected]#descriptor-flags".
//
// Descriptor flags.
@@ -263,7 +279,7 @@ func NewTimestampNoChange() NewTimestamp {
// NoChange returns true if [NewTimestamp] represents the variant case "no-change".
func (self *NewTimestamp) NoChange() bool {
- return cm.Tag(self) == 0
+ return self.Tag() == 0
}
// NewTimestampNow returns a [NewTimestamp] of case "now".
@@ -277,7 +293,7 @@ func NewTimestampNow() NewTimestamp {
// Now returns true if [NewTimestamp] represents the variant case "now".
func (self *NewTimestamp) Now() bool {
- return cm.Tag(self) == 1
+ return self.Tag() == 1
}
// NewTimestampTimestamp returns a [NewTimestamp] of case "timestamp".
@@ -470,6 +486,51 @@ const (
ErrorCodeCrossDevice
)
+var stringsErrorCode = [37]string{
+ "access",
+ "would-block",
+ "already",
+ "bad-descriptor",
+ "busy",
+ "deadlock",
+ "quota",
+ "exist",
+ "file-too-large",
+ "illegal-byte-sequence",
+ "in-progress",
+ "interrupted",
+ "invalid",
+ "io",
+ "is-directory",
+ "loop",
+ "too-many-links",
+ "message-size",
+ "name-too-long",
+ "no-device",
+ "no-entry",
+ "no-lock",
+ "insufficient-memory",
+ "insufficient-space",
+ "not-directory",
+ "not-empty",
+ "not-recoverable",
+ "unsupported",
+ "no-tty",
+ "no-such-device",
+ "overflow",
+ "not-permitted",
+ "pipe",
+ "read-only",
+ "invalid-seek",
+ "text-file-busy",
+ "cross-device",
+}
+
+// String implements [fmt.Stringer], returning the enum case name of e.
+func (e ErrorCode) String() string {
+ return stringsErrorCode[e]
+}
+
// Advice represents the enum "wasi:filesystem/[email protected]#advice".
//
// File or memory access pattern advisory information.
@@ -510,6 +571,20 @@ const (
AdviceNoReuse
)
+var stringsAdvice = [6]string{
+ "normal",
+ "sequential",
+ "random",
+ "will-need",
+ "dont-need",
+ "no-reuse",
+}
+
+// String implements [fmt.Stringer], returning the enum case name of e.
+func (e Advice) String() string {
+ return stringsAdvice[e]
+}
+
// MetadataHashValue represents the record "wasi:filesystem/[email protected]#metadata-hash-value".
//
// A 128-bit hash value, split into parts because wasm doesn't have a
@@ -560,7 +635,7 @@ func wasmimport_DescriptorResourceDrop(self0 uint32)
// advise: func(offset: filesize, length: filesize, advice: advice) -> result<_, error-code>
//
//go:nosplit
-func (self Descriptor) Advise(offset FileSize, length FileSize, advice Advice) (result cm.ErrResult[struct{}, ErrorCode]) {
+func (self Descriptor) Advise(offset FileSize, length FileSize, advice Advice) (result cm.Result[ErrorCode, struct{}, ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
offset0 := (uint64)(offset)
length0 := (uint64)(length)
@@ -571,7 +646,7 @@ func (self Descriptor) Advise(offset FileSize, length FileSize, advice Advice) (
//go:wasmimport wasi:filesystem/[email protected] [method]descriptor.advise
//go:noescape
-func wasmimport_DescriptorAdvise(self0 uint32, offset0 uint64, length0 uint64, advice0 uint32, result *cm.ErrResult[struct{}, ErrorCode])
+func wasmimport_DescriptorAdvise(self0 uint32, offset0 uint64, length0 uint64, advice0 uint32, result *cm.Result[ErrorCode, struct{}, ErrorCode])
// AppendViaStream represents the imported method "append-via-stream".
//
@@ -585,7 +660,7 @@ func wasmimport_DescriptorAdvise(self0 uint32, offset0 uint64, length0 uint64, a
// append-via-stream: func() -> result<output-stream, error-code>
//
//go:nosplit
-func (self Descriptor) AppendViaStream() (result cm.OKResult[streams.OutputStream, ErrorCode]) {
+func (self Descriptor) AppendViaStream() (result cm.Result[streams.OutputStream, streams.OutputStream, ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
wasmimport_DescriptorAppendViaStream((uint32)(self0), &result)
return
@@ -593,7 +668,7 @@ func (self Descriptor) AppendViaStream() (result cm.OKResult[streams.OutputStrea
//go:wasmimport wasi:filesystem/[email protected] [method]descriptor.append-via-stream
//go:noescape
-func wasmimport_DescriptorAppendViaStream(self0 uint32, result *cm.OKResult[streams.OutputStream, ErrorCode])
+func wasmimport_DescriptorAppendViaStream(self0 uint32, result *cm.Result[streams.OutputStream, streams.OutputStream, ErrorCode])
// CreateDirectoryAt represents the imported method "create-directory-at".
//
@@ -604,7 +679,7 @@ func wasmimport_DescriptorAppendViaStream(self0 uint32, result *cm.OKResult[stre
// create-directory-at: func(path: string) -> result<_, error-code>
//
//go:nosplit
-func (self Descriptor) CreateDirectoryAt(path string) (result cm.ErrResult[struct{}, ErrorCode]) {
+func (self Descriptor) CreateDirectoryAt(path string) (result cm.Result[ErrorCode, struct{}, ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
path0, path1 := cm.LowerString(path)
wasmimport_DescriptorCreateDirectoryAt((uint32)(self0), (*uint8)(path0), (uint32)(path1), &result)
@@ -613,7 +688,7 @@ func (self Descriptor) CreateDirectoryAt(path string) (result cm.ErrResult[struc
//go:wasmimport wasi:filesystem/[email protected] [method]descriptor.create-directory-at
//go:noescape
-func wasmimport_DescriptorCreateDirectoryAt(self0 uint32, path0 *uint8, path1 uint32, result *cm.ErrResult[struct{}, ErrorCode])
+func wasmimport_DescriptorCreateDirectoryAt(self0 uint32, path0 *uint8, path1 uint32, result *cm.Result[ErrorCode, struct{}, ErrorCode])
// GetFlags represents the imported method "get-flags".
//
@@ -627,7 +702,7 @@ func wasmimport_DescriptorCreateDirectoryAt(self0 uint32, path0 *uint8, path1 ui
// get-flags: func() -> result<descriptor-flags, error-code>
//
//go:nosplit
-func (self Descriptor) GetFlags() (result cm.OKResult[DescriptorFlags, ErrorCode]) {
+func (self Descriptor) GetFlags() (result cm.Result[DescriptorFlags, DescriptorFlags, ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
wasmimport_DescriptorGetFlags((uint32)(self0), &result)
return
@@ -635,7 +710,7 @@ func (self Descriptor) GetFlags() (result cm.OKResult[DescriptorFlags, ErrorCode
//go:wasmimport wasi:filesystem/[email protected] [method]descriptor.get-flags
//go:noescape
-func wasmimport_DescriptorGetFlags(self0 uint32, result *cm.OKResult[DescriptorFlags, ErrorCode])
+func wasmimport_DescriptorGetFlags(self0 uint32, result *cm.Result[DescriptorFlags, DescriptorFlags, ErrorCode])
// GetType represents the imported method "get-type".
//
@@ -653,7 +728,7 @@ func wasmimport_DescriptorGetFlags(self0 uint32, result *cm.OKResult[DescriptorF
// get-type: func() -> result<descriptor-type, error-code>
//
//go:nosplit
-func (self Descriptor) GetType() (result cm.OKResult[DescriptorType, ErrorCode]) {
+func (self Descriptor) GetType() (result cm.Result[DescriptorType, DescriptorType, ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
wasmimport_DescriptorGetType((uint32)(self0), &result)
return
@@ -661,7 +736,7 @@ func (self Descriptor) GetType() (result cm.OKResult[DescriptorType, ErrorCode])
//go:wasmimport wasi:filesystem/[email protected] [method]descriptor.get-type
//go:noescape
-func wasmimport_DescriptorGetType(self0 uint32, result *cm.OKResult[DescriptorType, ErrorCode])
+func wasmimport_DescriptorGetType(self0 uint32, result *cm.Result[DescriptorType, DescriptorType, ErrorCode])
// IsSameObject represents the imported method "is-same-object".
//
@@ -697,7 +772,7 @@ func wasmimport_DescriptorIsSameObject(self0 uint32, other0 uint32) (result0 uin
// new-path: string) -> result<_, error-code>
//
//go:nosplit
-func (self Descriptor) LinkAt(oldPathFlags PathFlags, oldPath string, newDescriptor Descriptor, newPath string) (result cm.ErrResult[struct{}, ErrorCode]) {
+func (self Descriptor) LinkAt(oldPathFlags PathFlags, oldPath string, newDescriptor Descriptor, newPath string) (result cm.Result[ErrorCode, struct{}, ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
oldPathFlags0 := (uint32)(oldPathFlags)
oldPath0, oldPath1 := cm.LowerString(oldPath)
@@ -709,7 +784,7 @@ func (self Descriptor) LinkAt(oldPathFlags PathFlags, oldPath string, newDescrip
//go:wasmimport wasi:filesystem/[email protected] [method]descriptor.link-at
//go:noescape
-func wasmimport_DescriptorLinkAt(self0 uint32, oldPathFlags0 uint32, oldPath0 *uint8, oldPath1 uint32, newDescriptor0 uint32, newPath0 *uint8, newPath1 uint32, result *cm.ErrResult[struct{}, ErrorCode])
+func wasmimport_DescriptorLinkAt(self0 uint32, oldPathFlags0 uint32, oldPath0 *uint8, oldPath1 uint32, newDescriptor0 uint32, newPath0 *uint8, newPath1 uint32, result *cm.Result[ErrorCode, struct{}, ErrorCode])
// MetadataHash represents the imported method "metadata-hash".
//
@@ -736,7 +811,7 @@ func wasmimport_DescriptorLinkAt(self0 uint32, oldPathFlags0 uint32, oldPath0 *u
// metadata-hash: func() -> result<metadata-hash-value, error-code>
//
//go:nosplit
-func (self Descriptor) MetadataHash() (result cm.OKResult[MetadataHashValue, ErrorCode]) {
+func (self Descriptor) MetadataHash() (result cm.Result[MetadataHashValueShape, MetadataHashValue, ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
wasmimport_DescriptorMetadataHash((uint32)(self0), &result)
return
@@ -744,7 +819,7 @@ func (self Descriptor) MetadataHash() (result cm.OKResult[MetadataHashValue, Err
//go:wasmimport wasi:filesystem/[email protected] [method]descriptor.metadata-hash
//go:noescape
-func wasmimport_DescriptorMetadataHash(self0 uint32, result *cm.OKResult[MetadataHashValue, ErrorCode])
+func wasmimport_DescriptorMetadataHash(self0 uint32, result *cm.Result[MetadataHashValueShape, MetadataHashValue, ErrorCode])
// MetadataHashAt represents the imported method "metadata-hash-at".
//
@@ -757,7 +832,7 @@ func wasmimport_DescriptorMetadataHash(self0 uint32, result *cm.OKResult[Metadat
// error-code>
//
//go:nosplit
-func (self Descriptor) MetadataHashAt(pathFlags PathFlags, path string) (result cm.OKResult[MetadataHashValue, ErrorCode]) {
+func (self Descriptor) MetadataHashAt(pathFlags PathFlags, path string) (result cm.Result[MetadataHashValueShape, MetadataHashValue, ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
pathFlags0 := (uint32)(pathFlags)
path0, path1 := cm.LowerString(path)
@@ -767,7 +842,7 @@ func (self Descriptor) MetadataHashAt(pathFlags PathFlags, path string) (result
//go:wasmimport wasi:filesystem/[email protected] [method]descriptor.metadata-hash-at
//go:noescape
-func wasmimport_DescriptorMetadataHashAt(self0 uint32, pathFlags0 uint32, path0 *uint8, path1 uint32, result *cm.OKResult[MetadataHashValue, ErrorCode])
+func wasmimport_DescriptorMetadataHashAt(self0 uint32, pathFlags0 uint32, path0 *uint8, path1 uint32, result *cm.Result[MetadataHashValueShape, MetadataHashValue, ErrorCode])
// OpenAt represents the imported method "open-at".
//
@@ -794,7 +869,7 @@ func wasmimport_DescriptorMetadataHashAt(self0 uint32, pathFlags0 uint32, path0
// descriptor-flags) -> result<descriptor, error-code>
//
//go:nosplit
-func (self Descriptor) OpenAt(pathFlags PathFlags, path string, openFlags OpenFlags, flags DescriptorFlags) (result cm.OKResult[Descriptor, ErrorCode]) {
+func (self Descriptor) OpenAt(pathFlags PathFlags, path string, openFlags OpenFlags, flags DescriptorFlags) (result cm.Result[Descriptor, Descriptor, ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
pathFlags0 := (uint32)(pathFlags)
path0, path1 := cm.LowerString(path)
@@ -806,7 +881,7 @@ func (self Descriptor) OpenAt(pathFlags PathFlags, path string, openFlags OpenFl
//go:wasmimport wasi:filesystem/[email protected] [method]descriptor.open-at
//go:noescape
-func wasmimport_DescriptorOpenAt(self0 uint32, pathFlags0 uint32, path0 *uint8, path1 uint32, openFlags0 uint32, flags0 uint32, result *cm.OKResult[Descriptor, ErrorCode])
+func wasmimport_DescriptorOpenAt(self0 uint32, pathFlags0 uint32, path0 *uint8, path1 uint32, openFlags0 uint32, flags0 uint32, result *cm.Result[Descriptor, Descriptor, ErrorCode])
// Read represents the imported method "read".
//
@@ -826,7 +901,7 @@ func wasmimport_DescriptorOpenAt(self0 uint32, pathFlags0 uint32, path0 *uint8,
// error-code>
//
//go:nosplit
-func (self Descriptor) Read(length FileSize, offset FileSize) (result cm.OKResult[cm.Tuple[cm.List[uint8], bool], ErrorCode]) {
+func (self Descriptor) Read(length FileSize, offset FileSize) (result cm.Result[TupleListU8BoolShape, cm.Tuple[cm.List[uint8], bool], ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
length0 := (uint64)(length)
offset0 := (uint64)(offset)
@@ -836,7 +911,7 @@ func (self Descriptor) Read(length FileSize, offset FileSize) (result cm.OKResul
//go:wasmimport wasi:filesystem/[email protected] [method]descriptor.read
//go:noescape
-func wasmimport_DescriptorRead(self0 uint32, length0 uint64, offset0 uint64, result *cm.OKResult[cm.Tuple[cm.List[uint8], bool], ErrorCode])
+func wasmimport_DescriptorRead(self0 uint32, length0 uint64, offset0 uint64, result *cm.Result[TupleListU8BoolShape, cm.Tuple[cm.List[uint8], bool], ErrorCode])
// ReadDirectory represents the imported method "read-directory".
//
@@ -853,7 +928,7 @@ func wasmimport_DescriptorRead(self0 uint32, length0 uint64, offset0 uint64, res
// read-directory: func() -> result<directory-entry-stream, error-code>
//
//go:nosplit
-func (self Descriptor) ReadDirectory() (result cm.OKResult[DirectoryEntryStream, ErrorCode]) {
+func (self Descriptor) ReadDirectory() (result cm.Result[DirectoryEntryStream, DirectoryEntryStream, ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
wasmimport_DescriptorReadDirectory((uint32)(self0), &result)
return
@@ -861,7 +936,7 @@ func (self Descriptor) ReadDirectory() (result cm.OKResult[DirectoryEntryStream,
//go:wasmimport wasi:filesystem/[email protected] [method]descriptor.read-directory
//go:noescape
-func wasmimport_DescriptorReadDirectory(self0 uint32, result *cm.OKResult[DirectoryEntryStream, ErrorCode])
+func wasmimport_DescriptorReadDirectory(self0 uint32, result *cm.Result[DirectoryEntryStream, DirectoryEntryStream, ErrorCode])
// ReadViaStream represents the imported method "read-via-stream".
//
@@ -877,7 +952,7 @@ func wasmimport_DescriptorReadDirectory(self0 uint32, result *cm.OKResult[Direct
// read-via-stream: func(offset: filesize) -> result<input-stream, error-code>
//
//go:nosplit
-func (self Descriptor) ReadViaStream(offset FileSize) (result cm.OKResult[streams.InputStream, ErrorCode]) {
+func (self Descriptor) ReadViaStream(offset FileSize) (result cm.Result[streams.InputStream, streams.InputStream, ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
offset0 := (uint64)(offset)
wasmimport_DescriptorReadViaStream((uint32)(self0), (uint64)(offset0), &result)
@@ -886,7 +961,7 @@ func (self Descriptor) ReadViaStream(offset FileSize) (result cm.OKResult[stream
//go:wasmimport wasi:filesystem/[email protected] [method]descriptor.read-via-stream
//go:noescape
-func wasmimport_DescriptorReadViaStream(self0 uint32, offset0 uint64, result *cm.OKResult[streams.InputStream, ErrorCode])
+func wasmimport_DescriptorReadViaStream(self0 uint32, offset0 uint64, result *cm.Result[streams.InputStream, streams.InputStream, ErrorCode])
// ReadLinkAt represents the imported method "readlink-at".
//
@@ -900,7 +975,7 @@ func wasmimport_DescriptorReadViaStream(self0 uint32, offset0 uint64, result *cm
// readlink-at: func(path: string) -> result<string, error-code>
//
//go:nosplit
-func (self Descriptor) ReadLinkAt(path string) (result cm.OKResult[string, ErrorCode]) {
+func (self Descriptor) ReadLinkAt(path string) (result cm.Result[string, string, ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
path0, path1 := cm.LowerString(path)
wasmimport_DescriptorReadLinkAt((uint32)(self0), (*uint8)(path0), (uint32)(path1), &result)
@@ -909,7 +984,7 @@ func (self Descriptor) ReadLinkAt(path string) (result cm.OKResult[string, Error
//go:wasmimport wasi:filesystem/[email protected] [method]descriptor.readlink-at
//go:noescape
-func wasmimport_DescriptorReadLinkAt(self0 uint32, path0 *uint8, path1 uint32, result *cm.OKResult[string, ErrorCode])
+func wasmimport_DescriptorReadLinkAt(self0 uint32, path0 *uint8, path1 uint32, result *cm.Result[string, string, ErrorCode])
// RemoveDirectoryAt represents the imported method "remove-directory-at".
//
@@ -922,7 +997,7 @@ func wasmimport_DescriptorReadLinkAt(self0 uint32, path0 *uint8, path1 uint32, r
// remove-directory-at: func(path: string) -> result<_, error-code>
//
//go:nosplit
-func (self Descriptor) RemoveDirectoryAt(path string) (result cm.ErrResult[struct{}, ErrorCode]) {
+func (self Descriptor) RemoveDirectoryAt(path string) (result cm.Result[ErrorCode, struct{}, ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
path0, path1 := cm.LowerString(path)
wasmimport_DescriptorRemoveDirectoryAt((uint32)(self0), (*uint8)(path0), (uint32)(path1), &result)
@@ -931,7 +1006,7 @@ func (self Descriptor) RemoveDirectoryAt(path string) (result cm.ErrResult[struc
//go:wasmimport wasi:filesystem/[email protected] [method]descriptor.remove-directory-at
//go:noescape
-func wasmimport_DescriptorRemoveDirectoryAt(self0 uint32, path0 *uint8, path1 uint32, result *cm.ErrResult[struct{}, ErrorCode])
+func wasmimport_DescriptorRemoveDirectoryAt(self0 uint32, path0 *uint8, path1 uint32, result *cm.Result[ErrorCode, struct{}, ErrorCode])
// RenameAt represents the imported method "rename-at".
//
@@ -943,7 +1018,7 @@ func wasmimport_DescriptorRemoveDirectoryAt(self0 uint32, path0 *uint8, path1 ui
// string) -> result<_, error-code>
//
//go:nosplit
-func (self Descriptor) RenameAt(oldPath string, newDescriptor Descriptor, newPath string) (result cm.ErrResult[struct{}, ErrorCode]) {
+func (self Descriptor) RenameAt(oldPath string, newDescriptor Descriptor, newPath string) (result cm.Result[ErrorCode, struct{}, ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
oldPath0, oldPath1 := cm.LowerString(oldPath)
newDescriptor0 := cm.Reinterpret[uint32](newDescriptor)
@@ -954,7 +1029,7 @@ func (self Descriptor) RenameAt(oldPath string, newDescriptor Descriptor, newPat
//go:wasmimport wasi:filesystem/[email protected] [method]descriptor.rename-at
//go:noescape
-func wasmimport_DescriptorRenameAt(self0 uint32, oldPath0 *uint8, oldPath1 uint32, newDescriptor0 uint32, newPath0 *uint8, newPath1 uint32, result *cm.ErrResult[struct{}, ErrorCode])
+func wasmimport_DescriptorRenameAt(self0 uint32, oldPath0 *uint8, oldPath1 uint32, newDescriptor0 uint32, newPath0 *uint8, newPath1 uint32, result *cm.Result[ErrorCode, struct{}, ErrorCode])
// SetSize represents the imported method "set-size".
//
@@ -966,7 +1041,7 @@ func wasmimport_DescriptorRenameAt(self0 uint32, oldPath0 *uint8, oldPath1 uint3
// set-size: func(size: filesize) -> result<_, error-code>
//
//go:nosplit
-func (self Descriptor) SetSize(size FileSize) (result cm.ErrResult[struct{}, ErrorCode]) {
+func (self Descriptor) SetSize(size FileSize) (result cm.Result[ErrorCode, struct{}, ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
size0 := (uint64)(size)
wasmimport_DescriptorSetSize((uint32)(self0), (uint64)(size0), &result)
@@ -975,7 +1050,7 @@ func (self Descriptor) SetSize(size FileSize) (result cm.ErrResult[struct{}, Err
//go:wasmimport wasi:filesystem/[email protected] [method]descriptor.set-size
//go:noescape
-func wasmimport_DescriptorSetSize(self0 uint32, size0 uint64, result *cm.ErrResult[struct{}, ErrorCode])
+func wasmimport_DescriptorSetSize(self0 uint32, size0 uint64, result *cm.Result[ErrorCode, struct{}, ErrorCode])
// SetTimes represents the imported method "set-times".
//
@@ -989,7 +1064,7 @@ func wasmimport_DescriptorSetSize(self0 uint32, size0 uint64, result *cm.ErrResu
// new-timestamp) -> result<_, error-code>
//
//go:nosplit
-func (self Descriptor) SetTimes(dataAccessTimestamp NewTimestamp, dataModificationTimestamp NewTimestamp) (result cm.ErrResult[struct{}, ErrorCode]) {
+func (self Descriptor) SetTimes(dataAccessTimestamp NewTimestamp, dataModificationTimestamp NewTimestamp) (result cm.Result[ErrorCode, struct{}, ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
dataAccessTimestamp0, dataAccessTimestamp1, dataAccessTimestamp2 := lower_NewTimestamp(dataAccessTimestamp)
dataModificationTimestamp0, dataModificationTimestamp1, dataModificationTimestamp2 := lower_NewTimestamp(dataModificationTimestamp)
@@ -999,7 +1074,7 @@ func (self Descriptor) SetTimes(dataAccessTimestamp NewTimestamp, dataModificati
//go:wasmimport wasi:filesystem/[email protected] [method]descriptor.set-times
//go:noescape
-func wasmimport_DescriptorSetTimes(self0 uint32, dataAccessTimestamp0 uint32, dataAccessTimestamp1 uint64, dataAccessTimestamp2 uint32, dataModificationTimestamp0 uint32, dataModificationTimestamp1 uint64, dataModificationTimestamp2 uint32, result *cm.ErrResult[struct{}, ErrorCode])
+func wasmimport_DescriptorSetTimes(self0 uint32, dataAccessTimestamp0 uint32, dataAccessTimestamp1 uint64, dataAccessTimestamp2 uint32, dataModificationTimestamp0 uint32, dataModificationTimestamp1 uint64, dataModificationTimestamp2 uint32, result *cm.Result[ErrorCode, struct{}, ErrorCode])
// SetTimesAt represents the imported method "set-times-at".
//
@@ -1014,7 +1089,7 @@ func wasmimport_DescriptorSetTimes(self0 uint32, dataAccessTimestamp0 uint32, da
// new-timestamp, data-modification-timestamp: new-timestamp) -> result<_, error-code>
//
//go:nosplit
-func (self Descriptor) SetTimesAt(pathFlags PathFlags, path string, dataAccessTimestamp NewTimestamp, dataModificationTimestamp NewTimestamp) (result cm.ErrResult[struct{}, ErrorCode]) {
+func (self Descriptor) SetTimesAt(pathFlags PathFlags, path string, dataAccessTimestamp NewTimestamp, dataModificationTimestamp NewTimestamp) (result cm.Result[ErrorCode, struct{}, ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
pathFlags0 := (uint32)(pathFlags)
path0, path1 := cm.LowerString(path)
@@ -1026,7 +1101,7 @@ func (self Descriptor) SetTimesAt(pathFlags PathFlags, path string, dataAccessTi
//go:wasmimport wasi:filesystem/[email protected] [method]descriptor.set-times-at
//go:noescape
-func wasmimport_DescriptorSetTimesAt(self0 uint32, pathFlags0 uint32, path0 *uint8, path1 uint32, dataAccessTimestamp0 uint32, dataAccessTimestamp1 uint64, dataAccessTimestamp2 uint32, dataModificationTimestamp0 uint32, dataModificationTimestamp1 uint64, dataModificationTimestamp2 uint32, result *cm.ErrResult[struct{}, ErrorCode])
+func wasmimport_DescriptorSetTimesAt(self0 uint32, pathFlags0 uint32, path0 *uint8, path1 uint32, dataAccessTimestamp0 uint32, dataAccessTimestamp1 uint64, dataAccessTimestamp2 uint32, dataModificationTimestamp0 uint32, dataModificationTimestamp1 uint64, dataModificationTimestamp2 uint32, result *cm.Result[ErrorCode, struct{}, ErrorCode])
// Stat represents the imported method "stat".
//
@@ -1043,7 +1118,7 @@ func wasmimport_DescriptorSetTimesAt(self0 uint32, pathFlags0 uint32, path0 *uin
// stat: func() -> result<descriptor-stat, error-code>
//
//go:nosplit
-func (self Descriptor) Stat() (result cm.OKResult[DescriptorStat, ErrorCode]) {
+func (self Descriptor) Stat() (result cm.Result[DescriptorStatShape, DescriptorStat, ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
wasmimport_DescriptorStat((uint32)(self0), &result)
return
@@ -1051,7 +1126,7 @@ func (self Descriptor) Stat() (result cm.OKResult[DescriptorStat, ErrorCode]) {
//go:wasmimport wasi:filesystem/[email protected] [method]descriptor.stat
//go:noescape
-func wasmimport_DescriptorStat(self0 uint32, result *cm.OKResult[DescriptorStat, ErrorCode])
+func wasmimport_DescriptorStat(self0 uint32, result *cm.Result[DescriptorStatShape, DescriptorStat, ErrorCode])
// StatAt represents the imported method "stat-at".
//
@@ -1067,7 +1142,7 @@ func wasmimport_DescriptorStat(self0 uint32, result *cm.OKResult[DescriptorStat,
// error-code>
//
//go:nosplit
-func (self Descriptor) StatAt(pathFlags PathFlags, path string) (result cm.OKResult[DescriptorStat, ErrorCode]) {
+func (self Descriptor) StatAt(pathFlags PathFlags, path string) (result cm.Result[DescriptorStatShape, DescriptorStat, ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
pathFlags0 := (uint32)(pathFlags)
path0, path1 := cm.LowerString(path)
@@ -1077,7 +1152,7 @@ func (self Descriptor) StatAt(pathFlags PathFlags, path string) (result cm.OKRes
//go:wasmimport wasi:filesystem/[email protected] [method]descriptor.stat-at
//go:noescape
-func wasmimport_DescriptorStatAt(self0 uint32, pathFlags0 uint32, path0 *uint8, path1 uint32, result *cm.OKResult[DescriptorStat, ErrorCode])
+func wasmimport_DescriptorStatAt(self0 uint32, pathFlags0 uint32, path0 *uint8, path1 uint32, result *cm.Result[DescriptorStatShape, DescriptorStat, ErrorCode])
// SymlinkAt represents the imported method "symlink-at".
//
@@ -1091,7 +1166,7 @@ func wasmimport_DescriptorStatAt(self0 uint32, pathFlags0 uint32, path0 *uint8,
// symlink-at: func(old-path: string, new-path: string) -> result<_, error-code>
//
//go:nosplit
-func (self Descriptor) SymlinkAt(oldPath string, newPath string) (result cm.ErrResult[struct{}, ErrorCode]) {
+func (self Descriptor) SymlinkAt(oldPath string, newPath string) (result cm.Result[ErrorCode, struct{}, ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
oldPath0, oldPath1 := cm.LowerString(oldPath)
newPath0, newPath1 := cm.LowerString(newPath)
@@ -1101,7 +1176,7 @@ func (self Descriptor) SymlinkAt(oldPath string, newPath string) (result cm.ErrR
//go:wasmimport wasi:filesystem/[email protected] [method]descriptor.symlink-at
//go:noescape
-func wasmimport_DescriptorSymlinkAt(self0 uint32, oldPath0 *uint8, oldPath1 uint32, newPath0 *uint8, newPath1 uint32, result *cm.ErrResult[struct{}, ErrorCode])
+func wasmimport_DescriptorSymlinkAt(self0 uint32, oldPath0 *uint8, oldPath1 uint32, newPath0 *uint8, newPath1 uint32, result *cm.Result[ErrorCode, struct{}, ErrorCode])
// Sync represents the imported method "sync".
//
@@ -1115,7 +1190,7 @@ func wasmimport_DescriptorSymlinkAt(self0 uint32, oldPath0 *uint8, oldPath1 uint
// sync: func() -> result<_, error-code>
//
//go:nosplit
-func (self Descriptor) Sync() (result cm.ErrResult[struct{}, ErrorCode]) {
+func (self Descriptor) Sync() (result cm.Result[ErrorCode, struct{}, ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
wasmimport_DescriptorSync((uint32)(self0), &result)
return
@@ -1123,7 +1198,7 @@ func (self Descriptor) Sync() (result cm.ErrResult[struct{}, ErrorCode]) {
//go:wasmimport wasi:filesystem/[email protected] [method]descriptor.sync
//go:noescape
-func wasmimport_DescriptorSync(self0 uint32, result *cm.ErrResult[struct{}, ErrorCode])
+func wasmimport_DescriptorSync(self0 uint32, result *cm.Result[ErrorCode, struct{}, ErrorCode])
// SyncData represents the imported method "sync-data".
//
@@ -1137,7 +1212,7 @@ func wasmimport_DescriptorSync(self0 uint32, result *cm.ErrResult[struct{}, Erro
// sync-data: func() -> result<_, error-code>
//
//go:nosplit
-func (self Descriptor) SyncData() (result cm.ErrResult[struct{}, ErrorCode]) {
+func (self Descriptor) SyncData() (result cm.Result[ErrorCode, struct{}, ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
wasmimport_DescriptorSyncData((uint32)(self0), &result)
return
@@ -1145,7 +1220,7 @@ func (self Descriptor) SyncData() (result cm.ErrResult[struct{}, ErrorCode]) {
//go:wasmimport wasi:filesystem/[email protected] [method]descriptor.sync-data
//go:noescape
-func wasmimport_DescriptorSyncData(self0 uint32, result *cm.ErrResult[struct{}, ErrorCode])
+func wasmimport_DescriptorSyncData(self0 uint32, result *cm.Result[ErrorCode, struct{}, ErrorCode])
// UnlinkFileAt represents the imported method "unlink-file-at".
//
@@ -1157,7 +1232,7 @@ func wasmimport_DescriptorSyncData(self0 uint32, result *cm.ErrResult[struct{},
// unlink-file-at: func(path: string) -> result<_, error-code>
//
//go:nosplit
-func (self Descriptor) UnlinkFileAt(path string) (result cm.ErrResult[struct{}, ErrorCode]) {
+func (self Descriptor) UnlinkFileAt(path string) (result cm.Result[ErrorCode, struct{}, ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
path0, path1 := cm.LowerString(path)
wasmimport_DescriptorUnlinkFileAt((uint32)(self0), (*uint8)(path0), (uint32)(path1), &result)
@@ -1166,7 +1241,7 @@ func (self Descriptor) UnlinkFileAt(path string) (result cm.ErrResult[struct{},
//go:wasmimport wasi:filesystem/[email protected] [method]descriptor.unlink-file-at
//go:noescape
-func wasmimport_DescriptorUnlinkFileAt(self0 uint32, path0 *uint8, path1 uint32, result *cm.ErrResult[struct{}, ErrorCode])
+func wasmimport_DescriptorUnlinkFileAt(self0 uint32, path0 *uint8, path1 uint32, result *cm.Result[ErrorCode, struct{}, ErrorCode])
// Write represents the imported method "write".
//
@@ -1183,7 +1258,7 @@ func wasmimport_DescriptorUnlinkFileAt(self0 uint32, path0 *uint8, path1 uint32,
// write: func(buffer: list<u8>, offset: filesize) -> result<filesize, error-code>
//
//go:nosplit
-func (self Descriptor) Write(buffer cm.List[uint8], offset FileSize) (result cm.OKResult[FileSize, ErrorCode]) {
+func (self Descriptor) Write(buffer cm.List[uint8], offset FileSize) (result cm.Result[uint64, FileSize, ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
buffer0, buffer1 := cm.LowerList(buffer)
offset0 := (uint64)(offset)
@@ -1193,7 +1268,7 @@ func (self Descriptor) Write(buffer cm.List[uint8], offset FileSize) (result cm.
//go:wasmimport wasi:filesystem/[email protected] [method]descriptor.write
//go:noescape
-func wasmimport_DescriptorWrite(self0 uint32, buffer0 *uint8, buffer1 uint32, offset0 uint64, result *cm.OKResult[FileSize, ErrorCode])
+func wasmimport_DescriptorWrite(self0 uint32, buffer0 *uint8, buffer1 uint32, offset0 uint64, result *cm.Result[uint64, FileSize, ErrorCode])
// WriteViaStream represents the imported method "write-via-stream".
//
@@ -1207,7 +1282,7 @@ func wasmimport_DescriptorWrite(self0 uint32, buffer0 *uint8, buffer1 uint32, of
// write-via-stream: func(offset: filesize) -> result<output-stream, error-code>
//
//go:nosplit
-func (self Descriptor) WriteViaStream(offset FileSize) (result cm.OKResult[streams.OutputStream, ErrorCode]) {
+func (self Descriptor) WriteViaStream(offset FileSize) (result cm.Result[streams.OutputStream, streams.OutputStream, ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
offset0 := (uint64)(offset)
wasmimport_DescriptorWriteViaStream((uint32)(self0), (uint64)(offset0), &result)
@@ -1216,7 +1291,7 @@ func (self Descriptor) WriteViaStream(offset FileSize) (result cm.OKResult[strea
//go:wasmimport wasi:filesystem/[email protected] [method]descriptor.write-via-stream
//go:noescape
-func wasmimport_DescriptorWriteViaStream(self0 uint32, offset0 uint64, result *cm.OKResult[streams.OutputStream, ErrorCode])
+func wasmimport_DescriptorWriteViaStream(self0 uint32, offset0 uint64, result *cm.Result[streams.OutputStream, streams.OutputStream, ErrorCode])
// DirectoryEntryStream represents the imported resource "wasi:filesystem/[email protected]#directory-entry-stream".
//
@@ -1247,7 +1322,7 @@ func wasmimport_DirectoryEntryStreamResourceDrop(self0 uint32)
// read-directory-entry: func() -> result<option<directory-entry>, error-code>
//
//go:nosplit
-func (self DirectoryEntryStream) ReadDirectoryEntry() (result cm.OKResult[cm.Option[DirectoryEntry], ErrorCode]) {
+func (self DirectoryEntryStream) ReadDirectoryEntry() (result cm.Result[OptionDirectoryEntryShape, cm.Option[DirectoryEntry], ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
wasmimport_DirectoryEntryStreamReadDirectoryEntry((uint32)(self0), &result)
return
@@ -1255,7 +1330,7 @@ func (self DirectoryEntryStream) ReadDirectoryEntry() (result cm.OKResult[cm.Opt
//go:wasmimport wasi:filesystem/[email protected] [method]directory-entry-stream.read-directory-entry
//go:noescape
-func wasmimport_DirectoryEntryStreamReadDirectoryEntry(self0 uint32, result *cm.OKResult[cm.Option[DirectoryEntry], ErrorCode])
+func wasmimport_DirectoryEntryStreamReadDirectoryEntry(self0 uint32, result *cm.Result[OptionDirectoryEntryShape, cm.Option[DirectoryEntry], ErrorCode])
// FilesystemErrorCode represents the imported function "filesystem-error-code".
//
diff --git a/src/internal/wasi/io/v0.2.0/streams/abi.go b/src/internal/wasi/io/v0.2.0/streams/abi.go
new file mode 100644
index 000000000..8d7592070
--- /dev/null
+++ b/src/internal/wasi/io/v0.2.0/streams/abi.go
@@ -0,0 +1,14 @@
+// Code generated by wit-bindgen-go. DO NOT EDIT.
+
+//go:build !wasip1
+
+package streams
+
+import (
+ "unsafe"
+)
+
+// StreamErrorShape is used for storage in variant or result types.
+type StreamErrorShape struct {
+ shape [unsafe.Sizeof(StreamError{})]byte
+}
diff --git a/src/internal/wasi/io/v0.2.0/streams/streams.wit.go b/src/internal/wasi/io/v0.2.0/streams/streams.wit.go
index 8983d5ac0..f3c1e3c35 100644
--- a/src/internal/wasi/io/v0.2.0/streams/streams.wit.go
+++ b/src/internal/wasi/io/v0.2.0/streams/streams.wit.go
@@ -53,7 +53,7 @@ func StreamErrorClosed() StreamError {
// Closed returns true if [StreamError] represents the variant case "closed".
func (self *StreamError) Closed() bool {
- return cm.Tag(self) == 1
+ return self.Tag() == 1
}
// InputStream represents the imported resource "wasi:io/[email protected]#input-stream".
@@ -93,7 +93,7 @@ func wasmimport_InputStreamResourceDrop(self0 uint32)
// blocking-read: func(len: u64) -> result<list<u8>, stream-error>
//
//go:nosplit
-func (self InputStream) BlockingRead(len_ uint64) (result cm.OKResult[cm.List[uint8], StreamError]) {
+func (self InputStream) BlockingRead(len_ uint64) (result cm.Result[cm.List[uint8], cm.List[uint8], StreamError]) {
self0 := cm.Reinterpret[uint32](self)
len0 := (uint64)(len_)
wasmimport_InputStreamBlockingRead((uint32)(self0), (uint64)(len0), &result)
@@ -102,7 +102,7 @@ func (self InputStream) BlockingRead(len_ uint64) (result cm.OKResult[cm.List[ui
//go:wasmimport wasi:io/[email protected] [method]input-stream.blocking-read
//go:noescape
-func wasmimport_InputStreamBlockingRead(self0 uint32, len0 uint64, result *cm.OKResult[cm.List[uint8], StreamError])
+func wasmimport_InputStreamBlockingRead(self0 uint32, len0 uint64, result *cm.Result[cm.List[uint8], cm.List[uint8], StreamError])
// BlockingSkip represents the imported method "blocking-skip".
//
@@ -112,7 +112,7 @@ func wasmimport_InputStreamBlockingRead(self0 uint32, len0 uint64, result *cm.OK
// blocking-skip: func(len: u64) -> result<u64, stream-error>
//
//go:nosplit
-func (self InputStream) BlockingSkip(len_ uint64) (result cm.OKResult[uint64, StreamError]) {
+func (self InputStream) BlockingSkip(len_ uint64) (result cm.Result[uint64, uint64, StreamError]) {
self0 := cm.Reinterpret[uint32](self)
len0 := (uint64)(len_)
wasmimport_InputStreamBlockingSkip((uint32)(self0), (uint64)(len0), &result)
@@ -121,7 +121,7 @@ func (self InputStream) BlockingSkip(len_ uint64) (result cm.OKResult[uint64, St
//go:wasmimport wasi:io/[email protected] [method]input-stream.blocking-skip
//go:noescape
-func wasmimport_InputStreamBlockingSkip(self0 uint32, len0 uint64, result *cm.OKResult[uint64, StreamError])
+func wasmimport_InputStreamBlockingSkip(self0 uint32, len0 uint64, result *cm.Result[uint64, uint64, StreamError])
// Read represents the imported method "read".
//
@@ -155,7 +155,7 @@ func wasmimport_InputStreamBlockingSkip(self0 uint32, len0 uint64, result *cm.OK
// read: func(len: u64) -> result<list<u8>, stream-error>
//
//go:nosplit
-func (self InputStream) Read(len_ uint64) (result cm.OKResult[cm.List[uint8], StreamError]) {
+func (self InputStream) Read(len_ uint64) (result cm.Result[cm.List[uint8], cm.List[uint8], StreamError]) {
self0 := cm.Reinterpret[uint32](self)
len0 := (uint64)(len_)
wasmimport_InputStreamRead((uint32)(self0), (uint64)(len0), &result)
@@ -164,7 +164,7 @@ func (self InputStream) Read(len_ uint64) (result cm.OKResult[cm.List[uint8], St
//go:wasmimport wasi:io/[email protected] [method]input-stream.read
//go:noescape
-func wasmimport_InputStreamRead(self0 uint32, len0 uint64, result *cm.OKResult[cm.List[uint8], StreamError])
+func wasmimport_InputStreamRead(self0 uint32, len0 uint64, result *cm.Result[cm.List[uint8], cm.List[uint8], StreamError])
// Skip represents the imported method "skip".
//
@@ -176,7 +176,7 @@ func wasmimport_InputStreamRead(self0 uint32, len0 uint64, result *cm.OKResult[c
// skip: func(len: u64) -> result<u64, stream-error>
//
//go:nosplit
-func (self InputStream) Skip(len_ uint64) (result cm.OKResult[uint64, StreamError]) {
+func (self InputStream) Skip(len_ uint64) (result cm.Result[uint64, uint64, StreamError]) {
self0 := cm.Reinterpret[uint32](self)
len0 := (uint64)(len_)
wasmimport_InputStreamSkip((uint32)(self0), (uint64)(len0), &result)
@@ -185,7 +185,7 @@ func (self InputStream) Skip(len_ uint64) (result cm.OKResult[uint64, StreamErro
//go:wasmimport wasi:io/[email protected] [method]input-stream.skip
//go:noescape
-func wasmimport_InputStreamSkip(self0 uint32, len0 uint64, result *cm.OKResult[uint64, StreamError])
+func wasmimport_InputStreamSkip(self0 uint32, len0 uint64, result *cm.Result[uint64, uint64, StreamError])
// Subscribe represents the imported method "subscribe".
//
@@ -247,7 +247,7 @@ func wasmimport_OutputStreamResourceDrop(self0 uint32)
// blocking-flush: func() -> result<_, stream-error>
//
//go:nosplit
-func (self OutputStream) BlockingFlush() (result cm.ErrResult[struct{}, StreamError]) {
+func (self OutputStream) BlockingFlush() (result cm.Result[StreamError, struct{}, StreamError]) {
self0 := cm.Reinterpret[uint32](self)
wasmimport_OutputStreamBlockingFlush((uint32)(self0), &result)
return
@@ -255,7 +255,7 @@ func (self OutputStream) BlockingFlush() (result cm.ErrResult[struct{}, StreamEr
//go:wasmimport wasi:io/[email protected] [method]output-stream.blocking-flush
//go:noescape
-func wasmimport_OutputStreamBlockingFlush(self0 uint32, result *cm.ErrResult[struct{}, StreamError])
+func wasmimport_OutputStreamBlockingFlush(self0 uint32, result *cm.Result[StreamError, struct{}, StreamError])
// BlockingSplice represents the imported method "blocking-splice".
//
@@ -268,7 +268,7 @@ func wasmimport_OutputStreamBlockingFlush(self0 uint32, result *cm.ErrResult[str
// blocking-splice: func(src: borrow<input-stream>, len: u64) -> result<u64, stream-error>
//
//go:nosplit
-func (self OutputStream) BlockingSplice(src InputStream, len_ uint64) (result cm.OKResult[uint64, StreamError]) {
+func (self OutputStream) BlockingSplice(src InputStream, len_ uint64) (result cm.Result[uint64, uint64, StreamError]) {
self0 := cm.Reinterpret[uint32](self)
src0 := cm.Reinterpret[uint32](src)
len0 := (uint64)(len_)
@@ -278,7 +278,7 @@ func (self OutputStream) BlockingSplice(src InputStream, len_ uint64) (result cm
//go:wasmimport wasi:io/[email protected] [method]output-stream.blocking-splice
//go:noescape
-func wasmimport_OutputStreamBlockingSplice(self0 uint32, src0 uint32, len0 uint64, result *cm.OKResult[uint64, StreamError])
+func wasmimport_OutputStreamBlockingSplice(self0 uint32, src0 uint32, len0 uint64, result *cm.Result[uint64, uint64, StreamError])
// BlockingWriteAndFlush represents the imported method "blocking-write-and-flush".
//
@@ -308,7 +308,7 @@ func wasmimport_OutputStreamBlockingSplice(self0 uint32, src0 uint32, len0 uint6
// blocking-write-and-flush: func(contents: list<u8>) -> result<_, stream-error>
//
//go:nosplit
-func (self OutputStream) BlockingWriteAndFlush(contents cm.List[uint8]) (result cm.ErrResult[struct{}, StreamError]) {
+func (self OutputStream) BlockingWriteAndFlush(contents cm.List[uint8]) (result cm.Result[StreamError, struct{}, StreamError]) {
self0 := cm.Reinterpret[uint32](self)
contents0, contents1 := cm.LowerList(contents)
wasmimport_OutputStreamBlockingWriteAndFlush((uint32)(self0), (*uint8)(contents0), (uint32)(contents1), &result)
@@ -317,7 +317,7 @@ func (self OutputStream) BlockingWriteAndFlush(contents cm.List[uint8]) (result
//go:wasmimport wasi:io/[email protected] [method]output-stream.blocking-write-and-flush
//go:noescape
-func wasmimport_OutputStreamBlockingWriteAndFlush(self0 uint32, contents0 *uint8, contents1 uint32, result *cm.ErrResult[struct{}, StreamError])
+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".
//
@@ -347,7 +347,7 @@ func wasmimport_OutputStreamBlockingWriteAndFlush(self0 uint32, contents0 *uint8
// blocking-write-zeroes-and-flush: func(len: u64) -> result<_, stream-error>
//
//go:nosplit
-func (self OutputStream) BlockingWriteZeroesAndFlush(len_ uint64) (result cm.ErrResult[struct{}, StreamError]) {
+func (self OutputStream) BlockingWriteZeroesAndFlush(len_ uint64) (result cm.Result[StreamError, struct{}, StreamError]) {
self0 := cm.Reinterpret[uint32](self)
len0 := (uint64)(len_)
wasmimport_OutputStreamBlockingWriteZeroesAndFlush((uint32)(self0), (uint64)(len0), &result)
@@ -356,7 +356,7 @@ func (self OutputStream) BlockingWriteZeroesAndFlush(len_ uint64) (result cm.Err
//go:wasmimport wasi:io/[email protected] [method]output-stream.blocking-write-zeroes-and-flush
//go:noescape
-func wasmimport_OutputStreamBlockingWriteZeroesAndFlush(self0 uint32, len0 uint64, result *cm.ErrResult[struct{}, StreamError])
+func wasmimport_OutputStreamBlockingWriteZeroesAndFlush(self0 uint32, len0 uint64, result *cm.Result[StreamError, struct{}, StreamError])
// CheckWrite represents the imported method "check-write".
//
@@ -373,7 +373,7 @@ func wasmimport_OutputStreamBlockingWriteZeroesAndFlush(self0 uint32, len0 uint6
// check-write: func() -> result<u64, stream-error>
//
//go:nosplit
-func (self OutputStream) CheckWrite() (result cm.OKResult[uint64, StreamError]) {
+func (self OutputStream) CheckWrite() (result cm.Result[uint64, uint64, StreamError]) {
self0 := cm.Reinterpret[uint32](self)
wasmimport_OutputStreamCheckWrite((uint32)(self0), &result)
return
@@ -381,7 +381,7 @@ func (self OutputStream) CheckWrite() (result cm.OKResult[uint64, StreamError])
//go:wasmimport wasi:io/[email protected] [method]output-stream.check-write
//go:noescape
-func wasmimport_OutputStreamCheckWrite(self0 uint32, result *cm.OKResult[uint64, StreamError])
+func wasmimport_OutputStreamCheckWrite(self0 uint32, result *cm.Result[uint64, uint64, StreamError])
// Flush represents the imported method "flush".
//
@@ -399,7 +399,7 @@ func wasmimport_OutputStreamCheckWrite(self0 uint32, result *cm.OKResult[uint64,
// flush: func() -> result<_, stream-error>
//
//go:nosplit
-func (self OutputStream) Flush() (result cm.ErrResult[struct{}, StreamError]) {
+func (self OutputStream) Flush() (result cm.Result[StreamError, struct{}, StreamError]) {
self0 := cm.Reinterpret[uint32](self)
wasmimport_OutputStreamFlush((uint32)(self0), &result)
return
@@ -407,7 +407,7 @@ func (self OutputStream) Flush() (result cm.ErrResult[struct{}, StreamError]) {
//go:wasmimport wasi:io/[email protected] [method]output-stream.flush
//go:noescape
-func wasmimport_OutputStreamFlush(self0 uint32, result *cm.ErrResult[struct{}, StreamError])
+func wasmimport_OutputStreamFlush(self0 uint32, result *cm.Result[StreamError, struct{}, StreamError])
// Splice represents the imported method "splice".
//
@@ -428,7 +428,7 @@ func wasmimport_OutputStreamFlush(self0 uint32, result *cm.ErrResult[struct{}, S
// splice: func(src: borrow<input-stream>, len: u64) -> result<u64, stream-error>
//
//go:nosplit
-func (self OutputStream) Splice(src InputStream, len_ uint64) (result cm.OKResult[uint64, StreamError]) {
+func (self OutputStream) Splice(src InputStream, len_ uint64) (result cm.Result[uint64, uint64, StreamError]) {
self0 := cm.Reinterpret[uint32](self)
src0 := cm.Reinterpret[uint32](src)
len0 := (uint64)(len_)
@@ -438,7 +438,7 @@ func (self OutputStream) Splice(src InputStream, len_ uint64) (result cm.OKResul
//go:wasmimport wasi:io/[email protected] [method]output-stream.splice
//go:noescape
-func wasmimport_OutputStreamSplice(self0 uint32, src0 uint32, len0 uint64, result *cm.OKResult[uint64, StreamError])
+func wasmimport_OutputStreamSplice(self0 uint32, src0 uint32, len0 uint64, result *cm.Result[uint64, uint64, StreamError])
// Subscribe represents the imported method "subscribe".
//
@@ -486,7 +486,7 @@ func wasmimport_OutputStreamSubscribe(self0 uint32) (result0 uint32)
// write: func(contents: list<u8>) -> result<_, stream-error>
//
//go:nosplit
-func (self OutputStream) Write(contents cm.List[uint8]) (result cm.ErrResult[struct{}, StreamError]) {
+func (self OutputStream) Write(contents cm.List[uint8]) (result cm.Result[StreamError, struct{}, StreamError]) {
self0 := cm.Reinterpret[uint32](self)
contents0, contents1 := cm.LowerList(contents)
wasmimport_OutputStreamWrite((uint32)(self0), (*uint8)(contents0), (uint32)(contents1), &result)
@@ -495,7 +495,7 @@ func (self OutputStream) Write(contents cm.List[uint8]) (result cm.ErrResult[str
//go:wasmimport wasi:io/[email protected] [method]output-stream.write
//go:noescape
-func wasmimport_OutputStreamWrite(self0 uint32, contents0 *uint8, contents1 uint32, result *cm.ErrResult[struct{}, StreamError])
+func wasmimport_OutputStreamWrite(self0 uint32, contents0 *uint8, contents1 uint32, result *cm.Result[StreamError, struct{}, StreamError])
// WriteZeroes represents the imported method "write-zeroes".
//
@@ -509,7 +509,7 @@ func wasmimport_OutputStreamWrite(self0 uint32, contents0 *uint8, contents1 uint
// write-zeroes: func(len: u64) -> result<_, stream-error>
//
//go:nosplit
-func (self OutputStream) WriteZeroes(len_ uint64) (result cm.ErrResult[struct{}, StreamError]) {
+func (self OutputStream) WriteZeroes(len_ uint64) (result cm.Result[StreamError, struct{}, StreamError]) {
self0 := cm.Reinterpret[uint32](self)
len0 := (uint64)(len_)
wasmimport_OutputStreamWriteZeroes((uint32)(self0), (uint64)(len0), &result)
@@ -518,4 +518,4 @@ func (self OutputStream) WriteZeroes(len_ uint64) (result cm.ErrResult[struct{},
//go:wasmimport wasi:io/[email protected] [method]output-stream.write-zeroes
//go:noescape
-func wasmimport_OutputStreamWriteZeroes(self0 uint32, len0 uint64, result *cm.ErrResult[struct{}, StreamError])
+func wasmimport_OutputStreamWriteZeroes(self0 uint32, len0 uint64, result *cm.Result[StreamError, struct{}, StreamError])
diff --git a/src/internal/wasi/sockets/v0.2.0/ip-name-lookup/abi.go b/src/internal/wasi/sockets/v0.2.0/ip-name-lookup/abi.go
new file mode 100644
index 000000000..065c935e1
--- /dev/null
+++ b/src/internal/wasi/sockets/v0.2.0/ip-name-lookup/abi.go
@@ -0,0 +1,16 @@
+// Code generated by wit-bindgen-go. DO NOT EDIT.
+
+//go:build !wasip1
+
+package ipnamelookup
+
+import (
+ "github.com/ydnar/wasm-tools-go/cm"
+ "internal/wasi/sockets/v0.2.0/network"
+ "unsafe"
+)
+
+// OptionIPAddressShape is used for storage in variant or result types.
+type OptionIPAddressShape struct {
+ shape [unsafe.Sizeof(cm.Option[network.IPAddress]{})]byte
+}
diff --git a/src/internal/wasi/sockets/v0.2.0/ip-name-lookup/ip-name-lookup.wit.go b/src/internal/wasi/sockets/v0.2.0/ip-name-lookup/ip-name-lookup.wit.go
index fc81b36ac..34ca3a6a0 100644
--- a/src/internal/wasi/sockets/v0.2.0/ip-name-lookup/ip-name-lookup.wit.go
+++ b/src/internal/wasi/sockets/v0.2.0/ip-name-lookup/ip-name-lookup.wit.go
@@ -53,7 +53,7 @@ func wasmimport_ResolveAddressStreamResourceDrop(self0 uint32)
// resolve-next-address: func() -> result<option<ip-address>, error-code>
//
//go:nosplit
-func (self ResolveAddressStream) ResolveNextAddress() (result cm.OKResult[cm.Option[network.IPAddress], network.ErrorCode]) {
+func (self ResolveAddressStream) ResolveNextAddress() (result cm.Result[OptionIPAddressShape, cm.Option[network.IPAddress], network.ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
wasmimport_ResolveAddressStreamResolveNextAddress((uint32)(self0), &result)
return
@@ -61,7 +61,7 @@ func (self ResolveAddressStream) ResolveNextAddress() (result cm.OKResult[cm.Opt
//go:wasmimport wasi:sockets/[email protected] [method]resolve-address-stream.resolve-next-address
//go:noescape
-func wasmimport_ResolveAddressStreamResolveNextAddress(self0 uint32, result *cm.OKResult[cm.Option[network.IPAddress], network.ErrorCode])
+func wasmimport_ResolveAddressStreamResolveNextAddress(self0 uint32, result *cm.Result[OptionIPAddressShape, cm.Option[network.IPAddress], network.ErrorCode])
// Subscribe represents the imported method "subscribe".
//
@@ -111,7 +111,7 @@ func wasmimport_ResolveAddressStreamSubscribe(self0 uint32) (result0 uint32)
// error-code>
//
//go:nosplit
-func ResolveAddresses(network_ network.Network, name string) (result cm.OKResult[ResolveAddressStream, network.ErrorCode]) {
+func ResolveAddresses(network_ network.Network, name string) (result cm.Result[ResolveAddressStream, ResolveAddressStream, network.ErrorCode]) {
network0 := cm.Reinterpret[uint32](network_)
name0, name1 := cm.LowerString(name)
wasmimport_ResolveAddresses((uint32)(network0), (*uint8)(name0), (uint32)(name1), &result)
@@ -120,4 +120,4 @@ func ResolveAddresses(network_ network.Network, name string) (result cm.OKResult
//go:wasmimport wasi:sockets/[email protected] resolve-addresses
//go:noescape
-func wasmimport_ResolveAddresses(network0 uint32, name0 *uint8, name1 uint32, result *cm.OKResult[ResolveAddressStream, network.ErrorCode])
+func wasmimport_ResolveAddresses(network0 uint32, name0 *uint8, name1 uint32, result *cm.Result[ResolveAddressStream, ResolveAddressStream, network.ErrorCode])
diff --git a/src/internal/wasi/sockets/v0.2.0/network/abi.go b/src/internal/wasi/sockets/v0.2.0/network/abi.go
new file mode 100644
index 000000000..ef9fc1e8d
--- /dev/null
+++ b/src/internal/wasi/sockets/v0.2.0/network/abi.go
@@ -0,0 +1,14 @@
+// Code generated by wit-bindgen-go. DO NOT EDIT.
+
+//go:build !wasip1
+
+package network
+
+import (
+ "unsafe"
+)
+
+// IPv6SocketAddressShape is used for storage in variant or result types.
+type IPv6SocketAddressShape struct {
+ shape [unsafe.Sizeof(IPv6SocketAddress{})]byte
+}
diff --git a/src/internal/wasi/sockets/v0.2.0/network/network.wit.go b/src/internal/wasi/sockets/v0.2.0/network/network.wit.go
index 4cca93aca..7108f6d97 100644
--- a/src/internal/wasi/sockets/v0.2.0/network/network.wit.go
+++ b/src/internal/wasi/sockets/v0.2.0/network/network.wit.go
@@ -159,6 +159,35 @@ const (
ErrorCodePermanentResolverFailure
)
+var stringsErrorCode = [21]string{
+ "unknown",
+ "access-denied",
+ "not-supported",
+ "invalid-argument",
+ "out-of-memory",
+ "timeout",
+ "concurrency-conflict",
+ "not-in-progress",
+ "would-block",
+ "invalid-state",
+ "new-socket-limit",
+ "address-not-bindable",
+ "address-in-use",
+ "remote-unreachable",
+ "connection-refused",
+ "connection-reset",
+ "connection-aborted",
+ "datagram-too-large",
+ "name-unresolvable",
+ "temporary-resolver-failure",
+ "permanent-resolver-failure",
+}
+
+// String implements [fmt.Stringer], returning the enum case name of e.
+func (e ErrorCode) String() string {
+ return stringsErrorCode[e]
+}
+
// IPAddressFamily represents the enum "wasi:sockets/[email protected]#ip-address-family".
//
// enum ip-address-family {
@@ -175,6 +204,16 @@ const (
IPAddressFamilyIPv6
)
+var stringsIPAddressFamily = [2]string{
+ "ipv4",
+ "ipv6",
+}
+
+// String implements [fmt.Stringer], returning the enum case name of e.
+func (e IPAddressFamily) String() string {
+ return stringsIPAddressFamily[e]
+}
+
// IPv4Address represents the tuple "wasi:sockets/[email protected]#ipv4-address".
//
// type ipv4-address = tuple<u8, u8, u8, u8>
@@ -255,7 +294,7 @@ type IPv6SocketAddress struct {
// ipv4(ipv4-socket-address),
// ipv6(ipv6-socket-address),
// }
-type IPSocketAddress cm.Variant[uint8, IPv6SocketAddress, IPv6SocketAddress]
+type IPSocketAddress cm.Variant[uint8, IPv6SocketAddressShape, IPv6SocketAddress]
// IPSocketAddressIPv4 returns a [IPSocketAddress] of case "ipv4".
func IPSocketAddressIPv4(data IPv4SocketAddress) IPSocketAddress {
diff --git a/src/internal/wasi/sockets/v0.2.0/tcp-create-socket/tcp-create-socket.wit.go b/src/internal/wasi/sockets/v0.2.0/tcp-create-socket/tcp-create-socket.wit.go
index 906128abe..06de81f96 100644
--- a/src/internal/wasi/sockets/v0.2.0/tcp-create-socket/tcp-create-socket.wit.go
+++ b/src/internal/wasi/sockets/v0.2.0/tcp-create-socket/tcp-create-socket.wit.go
@@ -43,7 +43,7 @@ import (
// error-code>
//
//go:nosplit
-func CreateTCPSocket(addressFamily network.IPAddressFamily) (result cm.OKResult[tcp.TCPSocket, network.ErrorCode]) {
+func CreateTCPSocket(addressFamily network.IPAddressFamily) (result cm.Result[tcp.TCPSocket, tcp.TCPSocket, network.ErrorCode]) {
addressFamily0 := (uint32)(addressFamily)
wasmimport_CreateTCPSocket((uint32)(addressFamily0), &result)
return
@@ -51,4 +51,4 @@ func CreateTCPSocket(addressFamily network.IPAddressFamily) (result cm.OKResult[
//go:wasmimport wasi:sockets/[email protected] create-tcp-socket
//go:noescape
-func wasmimport_CreateTCPSocket(addressFamily0 uint32, result *cm.OKResult[tcp.TCPSocket, network.ErrorCode])
+func wasmimport_CreateTCPSocket(addressFamily0 uint32, result *cm.Result[tcp.TCPSocket, tcp.TCPSocket, network.ErrorCode])
diff --git a/src/internal/wasi/sockets/v0.2.0/tcp/abi.go b/src/internal/wasi/sockets/v0.2.0/tcp/abi.go
index fecab79fd..39ccd2f62 100644
--- a/src/internal/wasi/sockets/v0.2.0/tcp/abi.go
+++ b/src/internal/wasi/sockets/v0.2.0/tcp/abi.go
@@ -6,9 +6,26 @@ package tcp
import (
"github.com/ydnar/wasm-tools-go/cm"
+ "internal/wasi/io/v0.2.0/streams"
"internal/wasi/sockets/v0.2.0/network"
+ "unsafe"
)
+// TupleTCPSocketInputStreamOutputStreamShape is used for storage in variant or result types.
+type TupleTCPSocketInputStreamOutputStreamShape struct {
+ shape [unsafe.Sizeof(cm.Tuple3[TCPSocket, streams.InputStream, streams.OutputStream]{})]byte
+}
+
+// TupleInputStreamOutputStreamShape is used for storage in variant or result types.
+type TupleInputStreamOutputStreamShape struct {
+ shape [unsafe.Sizeof(cm.Tuple[streams.InputStream, streams.OutputStream]{})]byte
+}
+
+// IPSocketAddressShape is used for storage in variant or result types.
+type IPSocketAddressShape struct {
+ shape [unsafe.Sizeof(network.IPSocketAddress{})]byte
+}
+
func lower_IPv4Address(v network.IPv4Address) (f0 uint32, f1 uint32, f2 uint32, f3 uint32) {
f0 = (uint32)(v[0])
f1 = (uint32)(v[1])
@@ -44,7 +61,7 @@ func lower_IPv6SocketAddress(v network.IPv6SocketAddress) (f0 uint32, f1 uint32,
}
func lower_IPSocketAddress(v network.IPSocketAddress) (f0 uint32, f1 uint32, f2 uint32, f3 uint32, f4 uint32, f5 uint32, f6 uint32, f7 uint32, f8 uint32, f9 uint32, f10 uint32, f11 uint32) {
- f0 = (uint32)(cm.Tag(&v))
+ f0 = (uint32)(v.Tag())
switch f0 {
case 0: // ipv4
v1, v2, v3, v4, v5 := lower_IPv4SocketAddress(*v.IPv4())
diff --git a/src/internal/wasi/sockets/v0.2.0/tcp/tcp.wit.go b/src/internal/wasi/sockets/v0.2.0/tcp/tcp.wit.go
index f390849cb..c306afef9 100644
--- a/src/internal/wasi/sockets/v0.2.0/tcp/tcp.wit.go
+++ b/src/internal/wasi/sockets/v0.2.0/tcp/tcp.wit.go
@@ -33,6 +33,17 @@ const (
ShutdownTypeBoth
)
+var stringsShutdownType = [3]string{
+ "receive",
+ "send",
+ "both",
+}
+
+// String implements [fmt.Stringer], returning the enum case name of e.
+func (e ShutdownType) String() string {
+ return stringsShutdownType[e]
+}
+
// TCPSocket represents the imported resource "wasi:sockets/[email protected]#tcp-socket".
//
// A TCP socket resource.
@@ -111,7 +122,7 @@ func wasmimport_TCPSocketResourceDrop(self0 uint32)
// accept: func() -> result<tuple<tcp-socket, input-stream, output-stream>, error-code>
//
//go:nosplit
-func (self TCPSocket) Accept() (result cm.OKResult[cm.Tuple3[TCPSocket, streams.InputStream, streams.OutputStream], network.ErrorCode]) {
+func (self TCPSocket) Accept() (result cm.Result[TupleTCPSocketInputStreamOutputStreamShape, cm.Tuple3[TCPSocket, streams.InputStream, streams.OutputStream], network.ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
wasmimport_TCPSocketAccept((uint32)(self0), &result)
return
@@ -119,7 +130,7 @@ func (self TCPSocket) Accept() (result cm.OKResult[cm.Tuple3[TCPSocket, streams.
//go:wasmimport wasi:sockets/[email protected] [method]tcp-socket.accept
//go:noescape
-func wasmimport_TCPSocketAccept(self0 uint32, result *cm.OKResult[cm.Tuple3[TCPSocket, streams.InputStream, streams.OutputStream], network.ErrorCode])
+func wasmimport_TCPSocketAccept(self0 uint32, result *cm.Result[TupleTCPSocketInputStreamOutputStreamShape, cm.Tuple3[TCPSocket, streams.InputStream, streams.OutputStream], network.ErrorCode])
// AddressFamily represents the imported method "address-family".
//
@@ -146,7 +157,7 @@ func wasmimport_TCPSocketAddressFamily(self0 uint32) (result0 uint32)
// finish-bind: func() -> result<_, error-code>
//
//go:nosplit
-func (self TCPSocket) FinishBind() (result cm.ErrResult[struct{}, network.ErrorCode]) {
+func (self TCPSocket) FinishBind() (result cm.Result[network.ErrorCode, struct{}, network.ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
wasmimport_TCPSocketFinishBind((uint32)(self0), &result)
return
@@ -154,14 +165,14 @@ func (self TCPSocket) FinishBind() (result cm.ErrResult[struct{}, network.ErrorC
//go:wasmimport wasi:sockets/[email protected] [method]tcp-socket.finish-bind
//go:noescape
-func wasmimport_TCPSocketFinishBind(self0 uint32, result *cm.ErrResult[struct{}, network.ErrorCode])
+func wasmimport_TCPSocketFinishBind(self0 uint32, result *cm.Result[network.ErrorCode, struct{}, network.ErrorCode])
// FinishConnect represents the imported method "finish-connect".
//
// finish-connect: func() -> result<tuple<input-stream, output-stream>, error-code>
//
//go:nosplit
-func (self TCPSocket) FinishConnect() (result cm.OKResult[cm.Tuple[streams.InputStream, streams.OutputStream], network.ErrorCode]) {
+func (self TCPSocket) FinishConnect() (result cm.Result[TupleInputStreamOutputStreamShape, cm.Tuple[streams.InputStream, streams.OutputStream], network.ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
wasmimport_TCPSocketFinishConnect((uint32)(self0), &result)
return
@@ -169,14 +180,14 @@ func (self TCPSocket) FinishConnect() (result cm.OKResult[cm.Tuple[streams.Input
//go:wasmimport wasi:sockets/[email protected] [method]tcp-socket.finish-connect
//go:noescape
-func wasmimport_TCPSocketFinishConnect(self0 uint32, result *cm.OKResult[cm.Tuple[streams.InputStream, streams.OutputStream], network.ErrorCode])
+func wasmimport_TCPSocketFinishConnect(self0 uint32, result *cm.Result[TupleInputStreamOutputStreamShape, cm.Tuple[streams.InputStream, streams.OutputStream], network.ErrorCode])
// FinishListen represents the imported method "finish-listen".
//
// finish-listen: func() -> result<_, error-code>
//
//go:nosplit
-func (self TCPSocket) FinishListen() (result cm.ErrResult[struct{}, network.ErrorCode]) {
+func (self TCPSocket) FinishListen() (result cm.Result[network.ErrorCode, struct{}, network.ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
wasmimport_TCPSocketFinishListen((uint32)(self0), &result)
return
@@ -184,7 +195,7 @@ func (self TCPSocket) FinishListen() (result cm.ErrResult[struct{}, network.Erro
//go:wasmimport wasi:sockets/[email protected] [method]tcp-socket.finish-listen
//go:noescape
-func wasmimport_TCPSocketFinishListen(self0 uint32, result *cm.ErrResult[struct{}, network.ErrorCode])
+func wasmimport_TCPSocketFinishListen(self0 uint32, result *cm.Result[network.ErrorCode, struct{}, network.ErrorCode])
// HopLimit represents the imported method "hop-limit".
//
@@ -198,7 +209,7 @@ func wasmimport_TCPSocketFinishListen(self0 uint32, result *cm.ErrResult[struct{
// hop-limit: func() -> result<u8, error-code>
//
//go:nosplit
-func (self TCPSocket) HopLimit() (result cm.OKResult[uint8, network.ErrorCode]) {
+func (self TCPSocket) HopLimit() (result cm.Result[uint8, uint8, network.ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
wasmimport_TCPSocketHopLimit((uint32)(self0), &result)
return
@@ -206,7 +217,7 @@ func (self TCPSocket) HopLimit() (result cm.OKResult[uint8, network.ErrorCode])
//go:wasmimport wasi:sockets/[email protected] [method]tcp-socket.hop-limit
//go:noescape
-func wasmimport_TCPSocketHopLimit(self0 uint32, result *cm.OKResult[uint8, network.ErrorCode])
+func wasmimport_TCPSocketHopLimit(self0 uint32, result *cm.Result[uint8, uint8, network.ErrorCode])
// IsListening represents the imported method "is-listening".
//
@@ -246,7 +257,7 @@ func wasmimport_TCPSocketIsListening(self0 uint32) (result0 uint32)
// keep-alive-count: func() -> result<u32, error-code>
//
//go:nosplit
-func (self TCPSocket) KeepAliveCount() (result cm.OKResult[uint32, network.ErrorCode]) {
+func (self TCPSocket) KeepAliveCount() (result cm.Result[uint32, uint32, network.ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
wasmimport_TCPSocketKeepAliveCount((uint32)(self0), &result)
return
@@ -254,7 +265,7 @@ func (self TCPSocket) KeepAliveCount() (result cm.OKResult[uint32, network.Error
//go:wasmimport wasi:sockets/[email protected] [method]tcp-socket.keep-alive-count
//go:noescape
-func wasmimport_TCPSocketKeepAliveCount(self0 uint32, result *cm.OKResult[uint32, network.ErrorCode])
+func wasmimport_TCPSocketKeepAliveCount(self0 uint32, result *cm.Result[uint32, uint32, network.ErrorCode])
// KeepAliveEnabled represents the imported method "keep-alive-enabled".
//
@@ -272,7 +283,7 @@ func wasmimport_TCPSocketKeepAliveCount(self0 uint32, result *cm.OKResult[uint32
// keep-alive-enabled: func() -> result<bool, error-code>
//
//go:nosplit
-func (self TCPSocket) KeepAliveEnabled() (result cm.OKResult[bool, network.ErrorCode]) {
+func (self TCPSocket) KeepAliveEnabled() (result cm.Result[bool, bool, network.ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
wasmimport_TCPSocketKeepAliveEnabled((uint32)(self0), &result)
return
@@ -280,7 +291,7 @@ func (self TCPSocket) KeepAliveEnabled() (result cm.OKResult[bool, network.Error
//go:wasmimport wasi:sockets/[email protected] [method]tcp-socket.keep-alive-enabled
//go:noescape
-func wasmimport_TCPSocketKeepAliveEnabled(self0 uint32, result *cm.OKResult[bool, network.ErrorCode])
+func wasmimport_TCPSocketKeepAliveEnabled(self0 uint32, result *cm.Result[bool, bool, network.ErrorCode])
// KeepAliveIdleTime represents the imported method "keep-alive-idle-time".
//
@@ -301,7 +312,7 @@ func wasmimport_TCPSocketKeepAliveEnabled(self0 uint32, result *cm.OKResult[bool
// keep-alive-idle-time: func() -> result<duration, error-code>
//
//go:nosplit
-func (self TCPSocket) KeepAliveIdleTime() (result cm.OKResult[monotonicclock.Duration, network.ErrorCode]) {
+func (self TCPSocket) KeepAliveIdleTime() (result cm.Result[uint64, monotonicclock.Duration, network.ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
wasmimport_TCPSocketKeepAliveIdleTime((uint32)(self0), &result)
return
@@ -309,7 +320,7 @@ func (self TCPSocket) KeepAliveIdleTime() (result cm.OKResult[monotonicclock.Dur
//go:wasmimport wasi:sockets/[email protected] [method]tcp-socket.keep-alive-idle-time
//go:noescape
-func wasmimport_TCPSocketKeepAliveIdleTime(self0 uint32, result *cm.OKResult[monotonicclock.Duration, network.ErrorCode])
+func wasmimport_TCPSocketKeepAliveIdleTime(self0 uint32, result *cm.Result[uint64, monotonicclock.Duration, network.ErrorCode])
// KeepAliveInterval represents the imported method "keep-alive-interval".
//
@@ -329,7 +340,7 @@ func wasmimport_TCPSocketKeepAliveIdleTime(self0 uint32, result *cm.OKResult[mon
// keep-alive-interval: func() -> result<duration, error-code>
//
//go:nosplit
-func (self TCPSocket) KeepAliveInterval() (result cm.OKResult[monotonicclock.Duration, network.ErrorCode]) {
+func (self TCPSocket) KeepAliveInterval() (result cm.Result[uint64, monotonicclock.Duration, network.ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
wasmimport_TCPSocketKeepAliveInterval((uint32)(self0), &result)
return
@@ -337,7 +348,7 @@ func (self TCPSocket) KeepAliveInterval() (result cm.OKResult[monotonicclock.Dur
//go:wasmimport wasi:sockets/[email protected] [method]tcp-socket.keep-alive-interval
//go:noescape
-func wasmimport_TCPSocketKeepAliveInterval(self0 uint32, result *cm.OKResult[monotonicclock.Duration, network.ErrorCode])
+func wasmimport_TCPSocketKeepAliveInterval(self0 uint32, result *cm.Result[uint64, monotonicclock.Duration, network.ErrorCode])
// LocalAddress represents the imported method "local-address".
//
@@ -362,7 +373,7 @@ func wasmimport_TCPSocketKeepAliveInterval(self0 uint32, result *cm.OKResult[mon
// local-address: func() -> result<ip-socket-address, error-code>
//
//go:nosplit
-func (self TCPSocket) LocalAddress() (result cm.OKResult[network.IPSocketAddress, network.ErrorCode]) {
+func (self TCPSocket) LocalAddress() (result cm.Result[IPSocketAddressShape, network.IPSocketAddress, network.ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
wasmimport_TCPSocketLocalAddress((uint32)(self0), &result)
return
@@ -370,7 +381,7 @@ func (self TCPSocket) LocalAddress() (result cm.OKResult[network.IPSocketAddress
//go:wasmimport wasi:sockets/[email protected] [method]tcp-socket.local-address
//go:noescape
-func wasmimport_TCPSocketLocalAddress(self0 uint32, result *cm.OKResult[network.IPSocketAddress, network.ErrorCode])
+func wasmimport_TCPSocketLocalAddress(self0 uint32, result *cm.Result[IPSocketAddressShape, network.IPSocketAddress, network.ErrorCode])
// ReceiveBufferSize represents the imported method "receive-buffer-size".
//
@@ -390,7 +401,7 @@ func wasmimport_TCPSocketLocalAddress(self0 uint32, result *cm.OKResult[network.
// receive-buffer-size: func() -> result<u64, error-code>
//
//go:nosplit
-func (self TCPSocket) ReceiveBufferSize() (result cm.OKResult[uint64, network.ErrorCode]) {
+func (self TCPSocket) ReceiveBufferSize() (result cm.Result[uint64, uint64, network.ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
wasmimport_TCPSocketReceiveBufferSize((uint32)(self0), &result)
return
@@ -398,7 +409,7 @@ func (self TCPSocket) ReceiveBufferSize() (result cm.OKResult[uint64, network.Er
//go:wasmimport wasi:sockets/[email protected] [method]tcp-socket.receive-buffer-size
//go:noescape
-func wasmimport_TCPSocketReceiveBufferSize(self0 uint32, result *cm.OKResult[uint64, network.ErrorCode])
+func wasmimport_TCPSocketReceiveBufferSize(self0 uint32, result *cm.Result[uint64, uint64, network.ErrorCode])
// RemoteAddress represents the imported method "remote-address".
//
@@ -416,7 +427,7 @@ func wasmimport_TCPSocketReceiveBufferSize(self0 uint32, result *cm.OKResult[uin
// remote-address: func() -> result<ip-socket-address, error-code>
//
//go:nosplit
-func (self TCPSocket) RemoteAddress() (result cm.OKResult[network.IPSocketAddress, network.ErrorCode]) {
+func (self TCPSocket) RemoteAddress() (result cm.Result[IPSocketAddressShape, network.IPSocketAddress, network.ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
wasmimport_TCPSocketRemoteAddress((uint32)(self0), &result)
return
@@ -424,14 +435,14 @@ func (self TCPSocket) RemoteAddress() (result cm.OKResult[network.IPSocketAddres
//go:wasmimport wasi:sockets/[email protected] [method]tcp-socket.remote-address
//go:noescape
-func wasmimport_TCPSocketRemoteAddress(self0 uint32, result *cm.OKResult[network.IPSocketAddress, network.ErrorCode])
+func wasmimport_TCPSocketRemoteAddress(self0 uint32, result *cm.Result[IPSocketAddressShape, network.IPSocketAddress, network.ErrorCode])
// SendBufferSize represents the imported method "send-buffer-size".
//
// send-buffer-size: func() -> result<u64, error-code>
//
//go:nosplit
-func (self TCPSocket) SendBufferSize() (result cm.OKResult[uint64, network.ErrorCode]) {
+func (self TCPSocket) SendBufferSize() (result cm.Result[uint64, uint64, network.ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
wasmimport_TCPSocketSendBufferSize((uint32)(self0), &result)
return
@@ -439,14 +450,14 @@ func (self TCPSocket) SendBufferSize() (result cm.OKResult[uint64, network.Error
//go:wasmimport wasi:sockets/[email protected] [method]tcp-socket.send-buffer-size
//go:noescape
-func wasmimport_TCPSocketSendBufferSize(self0 uint32, result *cm.OKResult[uint64, network.ErrorCode])
+func wasmimport_TCPSocketSendBufferSize(self0 uint32, result *cm.Result[uint64, uint64, network.ErrorCode])
// SetHopLimit represents the imported method "set-hop-limit".
//
// set-hop-limit: func(value: u8) -> result<_, error-code>
//
//go:nosplit
-func (self TCPSocket) SetHopLimit(value uint8) (result cm.ErrResult[struct{}, network.ErrorCode]) {
+func (self TCPSocket) SetHopLimit(value uint8) (result cm.Result[network.ErrorCode, struct{}, network.ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
value0 := (uint32)(value)
wasmimport_TCPSocketSetHopLimit((uint32)(self0), (uint32)(value0), &result)
@@ -455,14 +466,14 @@ func (self TCPSocket) SetHopLimit(value uint8) (result cm.ErrResult[struct{}, ne
//go:wasmimport wasi:sockets/[email protected] [method]tcp-socket.set-hop-limit
//go:noescape
-func wasmimport_TCPSocketSetHopLimit(self0 uint32, value0 uint32, result *cm.ErrResult[struct{}, network.ErrorCode])
+func wasmimport_TCPSocketSetHopLimit(self0 uint32, value0 uint32, result *cm.Result[network.ErrorCode, struct{}, network.ErrorCode])
// SetKeepAliveCount represents the imported method "set-keep-alive-count".
//
// set-keep-alive-count: func(value: u32) -> result<_, error-code>
//
//go:nosplit
-func (self TCPSocket) SetKeepAliveCount(value uint32) (result cm.ErrResult[struct{}, network.ErrorCode]) {
+func (self TCPSocket) SetKeepAliveCount(value uint32) (result cm.Result[network.ErrorCode, struct{}, network.ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
value0 := (uint32)(value)
wasmimport_TCPSocketSetKeepAliveCount((uint32)(self0), (uint32)(value0), &result)
@@ -471,14 +482,14 @@ func (self TCPSocket) SetKeepAliveCount(value uint32) (result cm.ErrResult[struc
//go:wasmimport wasi:sockets/[email protected] [method]tcp-socket.set-keep-alive-count
//go:noescape
-func wasmimport_TCPSocketSetKeepAliveCount(self0 uint32, value0 uint32, result *cm.ErrResult[struct{}, network.ErrorCode])
+func wasmimport_TCPSocketSetKeepAliveCount(self0 uint32, value0 uint32, result *cm.Result[network.ErrorCode, struct{}, network.ErrorCode])
// SetKeepAliveEnabled represents the imported method "set-keep-alive-enabled".
//
// set-keep-alive-enabled: func(value: bool) -> result<_, error-code>
//
//go:nosplit
-func (self TCPSocket) SetKeepAliveEnabled(value bool) (result cm.ErrResult[struct{}, network.ErrorCode]) {
+func (self TCPSocket) SetKeepAliveEnabled(value bool) (result cm.Result[network.ErrorCode, struct{}, network.ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
value0 := cm.BoolToU32(value)
wasmimport_TCPSocketSetKeepAliveEnabled((uint32)(self0), (uint32)(value0), &result)
@@ -487,14 +498,14 @@ func (self TCPSocket) SetKeepAliveEnabled(value bool) (result cm.ErrResult[struc
//go:wasmimport wasi:sockets/[email protected] [method]tcp-socket.set-keep-alive-enabled
//go:noescape
-func wasmimport_TCPSocketSetKeepAliveEnabled(self0 uint32, value0 uint32, result *cm.ErrResult[struct{}, network.ErrorCode])
+func wasmimport_TCPSocketSetKeepAliveEnabled(self0 uint32, value0 uint32, result *cm.Result[network.ErrorCode, struct{}, network.ErrorCode])
// SetKeepAliveIdleTime represents the imported method "set-keep-alive-idle-time".
//
// set-keep-alive-idle-time: func(value: duration) -> result<_, error-code>
//
//go:nosplit
-func (self TCPSocket) SetKeepAliveIdleTime(value monotonicclock.Duration) (result cm.ErrResult[struct{}, network.ErrorCode]) {
+func (self TCPSocket) SetKeepAliveIdleTime(value monotonicclock.Duration) (result cm.Result[network.ErrorCode, struct{}, network.ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
value0 := (uint64)(value)
wasmimport_TCPSocketSetKeepAliveIdleTime((uint32)(self0), (uint64)(value0), &result)
@@ -503,14 +514,14 @@ func (self TCPSocket) SetKeepAliveIdleTime(value monotonicclock.Duration) (resul
//go:wasmimport wasi:sockets/[email protected] [method]tcp-socket.set-keep-alive-idle-time
//go:noescape
-func wasmimport_TCPSocketSetKeepAliveIdleTime(self0 uint32, value0 uint64, result *cm.ErrResult[struct{}, network.ErrorCode])
+func wasmimport_TCPSocketSetKeepAliveIdleTime(self0 uint32, value0 uint64, result *cm.Result[network.ErrorCode, struct{}, network.ErrorCode])
// SetKeepAliveInterval represents the imported method "set-keep-alive-interval".
//
// set-keep-alive-interval: func(value: duration) -> result<_, error-code>
//
//go:nosplit
-func (self TCPSocket) SetKeepAliveInterval(value monotonicclock.Duration) (result cm.ErrResult[struct{}, network.ErrorCode]) {
+func (self TCPSocket) SetKeepAliveInterval(value monotonicclock.Duration) (result cm.Result[network.ErrorCode, struct{}, network.ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
value0 := (uint64)(value)
wasmimport_TCPSocketSetKeepAliveInterval((uint32)(self0), (uint64)(value0), &result)
@@ -519,7 +530,7 @@ func (self TCPSocket) SetKeepAliveInterval(value monotonicclock.Duration) (resul
//go:wasmimport wasi:sockets/[email protected] [method]tcp-socket.set-keep-alive-interval
//go:noescape
-func wasmimport_TCPSocketSetKeepAliveInterval(self0 uint32, value0 uint64, result *cm.ErrResult[struct{}, network.ErrorCode])
+func wasmimport_TCPSocketSetKeepAliveInterval(self0 uint32, value0 uint64, result *cm.Result[network.ErrorCode, struct{}, network.ErrorCode])
// SetListenBacklogSize represents the imported method "set-listen-backlog-size".
//
@@ -539,7 +550,7 @@ func wasmimport_TCPSocketSetKeepAliveInterval(self0 uint32, value0 uint64, resul
// set-listen-backlog-size: func(value: u64) -> result<_, error-code>
//
//go:nosplit
-func (self TCPSocket) SetListenBacklogSize(value uint64) (result cm.ErrResult[struct{}, network.ErrorCode]) {
+func (self TCPSocket) SetListenBacklogSize(value uint64) (result cm.Result[network.ErrorCode, struct{}, network.ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
value0 := (uint64)(value)
wasmimport_TCPSocketSetListenBacklogSize((uint32)(self0), (uint64)(value0), &result)
@@ -548,14 +559,14 @@ func (self TCPSocket) SetListenBacklogSize(value uint64) (result cm.ErrResult[st
//go:wasmimport wasi:sockets/[email protected] [method]tcp-socket.set-listen-backlog-size
//go:noescape
-func wasmimport_TCPSocketSetListenBacklogSize(self0 uint32, value0 uint64, result *cm.ErrResult[struct{}, network.ErrorCode])
+func wasmimport_TCPSocketSetListenBacklogSize(self0 uint32, value0 uint64, result *cm.Result[network.ErrorCode, struct{}, network.ErrorCode])
// SetReceiveBufferSize represents the imported method "set-receive-buffer-size".
//
// set-receive-buffer-size: func(value: u64) -> result<_, error-code>
//
//go:nosplit
-func (self TCPSocket) SetReceiveBufferSize(value uint64) (result cm.ErrResult[struct{}, network.ErrorCode]) {
+func (self TCPSocket) SetReceiveBufferSize(value uint64) (result cm.Result[network.ErrorCode, struct{}, network.ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
value0 := (uint64)(value)
wasmimport_TCPSocketSetReceiveBufferSize((uint32)(self0), (uint64)(value0), &result)
@@ -564,14 +575,14 @@ func (self TCPSocket) SetReceiveBufferSize(value uint64) (result cm.ErrResult[st
//go:wasmimport wasi:sockets/[email protected] [method]tcp-socket.set-receive-buffer-size
//go:noescape
-func wasmimport_TCPSocketSetReceiveBufferSize(self0 uint32, value0 uint64, result *cm.ErrResult[struct{}, network.ErrorCode])
+func wasmimport_TCPSocketSetReceiveBufferSize(self0 uint32, value0 uint64, result *cm.Result[network.ErrorCode, struct{}, network.ErrorCode])
// SetSendBufferSize represents the imported method "set-send-buffer-size".
//
// set-send-buffer-size: func(value: u64) -> result<_, error-code>
//
//go:nosplit
-func (self TCPSocket) SetSendBufferSize(value uint64) (result cm.ErrResult[struct{}, network.ErrorCode]) {
+func (self TCPSocket) SetSendBufferSize(value uint64) (result cm.Result[network.ErrorCode, struct{}, network.ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
value0 := (uint64)(value)
wasmimport_TCPSocketSetSendBufferSize((uint32)(self0), (uint64)(value0), &result)
@@ -580,7 +591,7 @@ func (self TCPSocket) SetSendBufferSize(value uint64) (result cm.ErrResult[struc
//go:wasmimport wasi:sockets/[email protected] [method]tcp-socket.set-send-buffer-size
//go:noescape
-func wasmimport_TCPSocketSetSendBufferSize(self0 uint32, value0 uint64, result *cm.ErrResult[struct{}, network.ErrorCode])
+func wasmimport_TCPSocketSetSendBufferSize(self0 uint32, value0 uint64, result *cm.Result[network.ErrorCode, struct{}, network.ErrorCode])
// Shutdown represents the imported method "shutdown".
//
@@ -611,7 +622,7 @@ func wasmimport_TCPSocketSetSendBufferSize(self0 uint32, value0 uint64, result *
// shutdown: func(shutdown-type: shutdown-type) -> result<_, error-code>
//
//go:nosplit
-func (self TCPSocket) Shutdown(shutdownType ShutdownType) (result cm.ErrResult[struct{}, network.ErrorCode]) {
+func (self TCPSocket) Shutdown(shutdownType ShutdownType) (result cm.Result[network.ErrorCode, struct{}, network.ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
shutdownType0 := (uint32)(shutdownType)
wasmimport_TCPSocketShutdown((uint32)(self0), (uint32)(shutdownType0), &result)
@@ -620,7 +631,7 @@ func (self TCPSocket) Shutdown(shutdownType ShutdownType) (result cm.ErrResult[s
//go:wasmimport wasi:sockets/[email protected] [method]tcp-socket.shutdown
//go:noescape
-func wasmimport_TCPSocketShutdown(self0 uint32, shutdownType0 uint32, result *cm.ErrResult[struct{}, network.ErrorCode])
+func wasmimport_TCPSocketShutdown(self0 uint32, shutdownType0 uint32, result *cm.Result[network.ErrorCode, struct{}, network.ErrorCode])
// StartBind represents the imported method "start-bind".
//
@@ -676,7 +687,7 @@ func wasmimport_TCPSocketShutdown(self0 uint32, shutdownType0 uint32, result *cm
// result<_, error-code>
//
//go:nosplit
-func (self TCPSocket) StartBind(network_ network.Network, localAddress network.IPSocketAddress) (result cm.ErrResult[struct{}, network.ErrorCode]) {
+func (self TCPSocket) StartBind(network_ network.Network, localAddress network.IPSocketAddress) (result cm.Result[network.ErrorCode, struct{}, network.ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
network0 := cm.Reinterpret[uint32](network_)
localAddress0, localAddress1, localAddress2, localAddress3, localAddress4, localAddress5, localAddress6, localAddress7, localAddress8, localAddress9, localAddress10, localAddress11 := lower_IPSocketAddress(localAddress)
@@ -686,7 +697,7 @@ func (self TCPSocket) StartBind(network_ network.Network, localAddress network.I
//go:wasmimport wasi:sockets/[email protected] [method]tcp-socket.start-bind
//go:noescape
-func wasmimport_TCPSocketStartBind(self0 uint32, network0 uint32, localAddress0 uint32, localAddress1 uint32, localAddress2 uint32, localAddress3 uint32, localAddress4 uint32, localAddress5 uint32, localAddress6 uint32, localAddress7 uint32, localAddress8 uint32, localAddress9 uint32, localAddress10 uint32, localAddress11 uint32, result *cm.ErrResult[struct{}, network.ErrorCode])
+func wasmimport_TCPSocketStartBind(self0 uint32, network0 uint32, localAddress0 uint32, localAddress1 uint32, localAddress2 uint32, localAddress3 uint32, localAddress4 uint32, localAddress5 uint32, localAddress6 uint32, localAddress7 uint32, localAddress8 uint32, localAddress9 uint32, localAddress10 uint32, localAddress11 uint32, result *cm.Result[network.ErrorCode, struct{}, network.ErrorCode])
// StartConnect represents the imported method "start-connect".
//
@@ -748,7 +759,7 @@ func wasmimport_TCPSocketStartBind(self0 uint32, network0 uint32, localAddress0
// -> result<_, error-code>
//
//go:nosplit
-func (self TCPSocket) StartConnect(network_ network.Network, remoteAddress network.IPSocketAddress) (result cm.ErrResult[struct{}, network.ErrorCode]) {
+func (self TCPSocket) StartConnect(network_ network.Network, remoteAddress network.IPSocketAddress) (result cm.Result[network.ErrorCode, struct{}, network.ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
network0 := cm.Reinterpret[uint32](network_)
remoteAddress0, remoteAddress1, remoteAddress2, remoteAddress3, remoteAddress4, remoteAddress5, remoteAddress6, remoteAddress7, remoteAddress8, remoteAddress9, remoteAddress10, remoteAddress11 := lower_IPSocketAddress(remoteAddress)
@@ -758,7 +769,7 @@ func (self TCPSocket) StartConnect(network_ network.Network, remoteAddress netwo
//go:wasmimport wasi:sockets/[email protected] [method]tcp-socket.start-connect
//go:noescape
-func wasmimport_TCPSocketStartConnect(self0 uint32, network0 uint32, remoteAddress0 uint32, remoteAddress1 uint32, remoteAddress2 uint32, remoteAddress3 uint32, remoteAddress4 uint32, remoteAddress5 uint32, remoteAddress6 uint32, remoteAddress7 uint32, remoteAddress8 uint32, remoteAddress9 uint32, remoteAddress10 uint32, remoteAddress11 uint32, result *cm.ErrResult[struct{}, network.ErrorCode])
+func wasmimport_TCPSocketStartConnect(self0 uint32, network0 uint32, remoteAddress0 uint32, remoteAddress1 uint32, remoteAddress2 uint32, remoteAddress3 uint32, remoteAddress4 uint32, remoteAddress5 uint32, remoteAddress6 uint32, remoteAddress7 uint32, remoteAddress8 uint32, remoteAddress9 uint32, remoteAddress10 uint32, remoteAddress11 uint32, result *cm.Result[network.ErrorCode, struct{}, network.ErrorCode])
// StartListen represents the imported method "start-listen".
//
@@ -794,7 +805,7 @@ func wasmimport_TCPSocketStartConnect(self0 uint32, network0 uint32, remoteAddre
// start-listen: func() -> result<_, error-code>
//
//go:nosplit
-func (self TCPSocket) StartListen() (result cm.ErrResult[struct{}, network.ErrorCode]) {
+func (self TCPSocket) StartListen() (result cm.Result[network.ErrorCode, struct{}, network.ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
wasmimport_TCPSocketStartListen((uint32)(self0), &result)
return
@@ -802,7 +813,7 @@ func (self TCPSocket) StartListen() (result cm.ErrResult[struct{}, network.Error
//go:wasmimport wasi:sockets/[email protected] [method]tcp-socket.start-listen
//go:noescape
-func wasmimport_TCPSocketStartListen(self0 uint32, result *cm.ErrResult[struct{}, network.ErrorCode])
+func wasmimport_TCPSocketStartListen(self0 uint32, result *cm.Result[network.ErrorCode, struct{}, network.ErrorCode])
// Subscribe represents the imported method "subscribe".
//
diff --git a/src/internal/wasi/sockets/v0.2.0/udp-create-socket/udp-create-socket.wit.go b/src/internal/wasi/sockets/v0.2.0/udp-create-socket/udp-create-socket.wit.go
index a73695a9c..b30bafaad 100644
--- a/src/internal/wasi/sockets/v0.2.0/udp-create-socket/udp-create-socket.wit.go
+++ b/src/internal/wasi/sockets/v0.2.0/udp-create-socket/udp-create-socket.wit.go
@@ -43,7 +43,7 @@ import (
// error-code>
//
//go:nosplit
-func CreateUDPSocket(addressFamily network.IPAddressFamily) (result cm.OKResult[udp.UDPSocket, network.ErrorCode]) {
+func CreateUDPSocket(addressFamily network.IPAddressFamily) (result cm.Result[udp.UDPSocket, udp.UDPSocket, network.ErrorCode]) {
addressFamily0 := (uint32)(addressFamily)
wasmimport_CreateUDPSocket((uint32)(addressFamily0), &result)
return
@@ -51,4 +51,4 @@ func CreateUDPSocket(addressFamily network.IPAddressFamily) (result cm.OKResult[
//go:wasmimport wasi:sockets/[email protected] create-udp-socket
//go:noescape
-func wasmimport_CreateUDPSocket(addressFamily0 uint32, result *cm.OKResult[udp.UDPSocket, network.ErrorCode])
+func wasmimport_CreateUDPSocket(addressFamily0 uint32, result *cm.Result[udp.UDPSocket, udp.UDPSocket, network.ErrorCode])
diff --git a/src/internal/wasi/sockets/v0.2.0/udp/abi.go b/src/internal/wasi/sockets/v0.2.0/udp/abi.go
index c62d3322d..47954d872 100644
--- a/src/internal/wasi/sockets/v0.2.0/udp/abi.go
+++ b/src/internal/wasi/sockets/v0.2.0/udp/abi.go
@@ -7,8 +7,14 @@ package udp
import (
"github.com/ydnar/wasm-tools-go/cm"
"internal/wasi/sockets/v0.2.0/network"
+ "unsafe"
)
+// IPSocketAddressShape is used for storage in variant or result types.
+type IPSocketAddressShape struct {
+ shape [unsafe.Sizeof(network.IPSocketAddress{})]byte
+}
+
func lower_IPv4Address(v network.IPv4Address) (f0 uint32, f1 uint32, f2 uint32, f3 uint32) {
f0 = (uint32)(v[0])
f1 = (uint32)(v[1])
@@ -44,7 +50,7 @@ func lower_IPv6SocketAddress(v network.IPv6SocketAddress) (f0 uint32, f1 uint32,
}
func lower_IPSocketAddress(v network.IPSocketAddress) (f0 uint32, f1 uint32, f2 uint32, f3 uint32, f4 uint32, f5 uint32, f6 uint32, f7 uint32, f8 uint32, f9 uint32, f10 uint32, f11 uint32) {
- f0 = (uint32)(cm.Tag(&v))
+ f0 = (uint32)(v.Tag())
switch f0 {
case 0: // ipv4
v1, v2, v3, v4, v5 := lower_IPv4SocketAddress(*v.IPv4())
@@ -70,6 +76,11 @@ func lower_IPSocketAddress(v network.IPSocketAddress) (f0 uint32, f1 uint32, f2
return
}
+// TupleIncomingDatagramStreamOutgoingDatagramStreamShape is used for storage in variant or result types.
+type TupleIncomingDatagramStreamOutgoingDatagramStreamShape struct {
+ shape [unsafe.Sizeof(cm.Tuple[IncomingDatagramStream, OutgoingDatagramStream]{})]byte
+}
+
func lower_OptionIPSocketAddress(v cm.Option[network.IPSocketAddress]) (f0 uint32, f1 uint32, f2 uint32, f3 uint32, f4 uint32, f5 uint32, f6 uint32, f7 uint32, f8 uint32, f9 uint32, f10 uint32, f11 uint32, f12 uint32) {
some := v.Some()
if some != nil {
diff --git a/src/internal/wasi/sockets/v0.2.0/udp/udp.wit.go b/src/internal/wasi/sockets/v0.2.0/udp/udp.wit.go
index 41b3b9ac0..075739876 100644
--- a/src/internal/wasi/sockets/v0.2.0/udp/udp.wit.go
+++ b/src/internal/wasi/sockets/v0.2.0/udp/udp.wit.go
@@ -105,7 +105,7 @@ func wasmimport_UDPSocketAddressFamily(self0 uint32) (result0 uint32)
// finish-bind: func() -> result<_, error-code>
//
//go:nosplit
-func (self UDPSocket) FinishBind() (result cm.ErrResult[struct{}, network.ErrorCode]) {
+func (self UDPSocket) FinishBind() (result cm.Result[network.ErrorCode, struct{}, network.ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
wasmimport_UDPSocketFinishBind((uint32)(self0), &result)
return
@@ -113,7 +113,7 @@ func (self UDPSocket) FinishBind() (result cm.ErrResult[struct{}, network.ErrorC
//go:wasmimport wasi:sockets/[email protected] [method]udp-socket.finish-bind
//go:noescape
-func wasmimport_UDPSocketFinishBind(self0 uint32, result *cm.ErrResult[struct{}, network.ErrorCode])
+func wasmimport_UDPSocketFinishBind(self0 uint32, result *cm.Result[network.ErrorCode, struct{}, network.ErrorCode])
// LocalAddress represents the imported method "local-address".
//
@@ -138,7 +138,7 @@ func wasmimport_UDPSocketFinishBind(self0 uint32, result *cm.ErrResult[struct{},
// local-address: func() -> result<ip-socket-address, error-code>
//
//go:nosplit
-func (self UDPSocket) LocalAddress() (result cm.OKResult[network.IPSocketAddress, network.ErrorCode]) {
+func (self UDPSocket) LocalAddress() (result cm.Result[IPSocketAddressShape, network.IPSocketAddress, network.ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
wasmimport_UDPSocketLocalAddress((uint32)(self0), &result)
return
@@ -146,7 +146,7 @@ func (self UDPSocket) LocalAddress() (result cm.OKResult[network.IPSocketAddress
//go:wasmimport wasi:sockets/[email protected] [method]udp-socket.local-address
//go:noescape
-func wasmimport_UDPSocketLocalAddress(self0 uint32, result *cm.OKResult[network.IPSocketAddress, network.ErrorCode])
+func wasmimport_UDPSocketLocalAddress(self0 uint32, result *cm.Result[IPSocketAddressShape, network.IPSocketAddress, network.ErrorCode])
// ReceiveBufferSize represents the imported method "receive-buffer-size".
//
@@ -166,7 +166,7 @@ func wasmimport_UDPSocketLocalAddress(self0 uint32, result *cm.OKResult[network.
// receive-buffer-size: func() -> result<u64, error-code>
//
//go:nosplit
-func (self UDPSocket) ReceiveBufferSize() (result cm.OKResult[uint64, network.ErrorCode]) {
+func (self UDPSocket) ReceiveBufferSize() (result cm.Result[uint64, uint64, network.ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
wasmimport_UDPSocketReceiveBufferSize((uint32)(self0), &result)
return
@@ -174,7 +174,7 @@ func (self UDPSocket) ReceiveBufferSize() (result cm.OKResult[uint64, network.Er
//go:wasmimport wasi:sockets/[email protected] [method]udp-socket.receive-buffer-size
//go:noescape
-func wasmimport_UDPSocketReceiveBufferSize(self0 uint32, result *cm.OKResult[uint64, network.ErrorCode])
+func wasmimport_UDPSocketReceiveBufferSize(self0 uint32, result *cm.Result[uint64, uint64, network.ErrorCode])
// RemoteAddress represents the imported method "remote-address".
//
@@ -192,7 +192,7 @@ func wasmimport_UDPSocketReceiveBufferSize(self0 uint32, result *cm.OKResult[uin
// remote-address: func() -> result<ip-socket-address, error-code>
//
//go:nosplit
-func (self UDPSocket) RemoteAddress() (result cm.OKResult[network.IPSocketAddress, network.ErrorCode]) {
+func (self UDPSocket) RemoteAddress() (result cm.Result[IPSocketAddressShape, network.IPSocketAddress, network.ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
wasmimport_UDPSocketRemoteAddress((uint32)(self0), &result)
return
@@ -200,14 +200,14 @@ func (self UDPSocket) RemoteAddress() (result cm.OKResult[network.IPSocketAddres
//go:wasmimport wasi:sockets/[email protected] [method]udp-socket.remote-address
//go:noescape
-func wasmimport_UDPSocketRemoteAddress(self0 uint32, result *cm.OKResult[network.IPSocketAddress, network.ErrorCode])
+func wasmimport_UDPSocketRemoteAddress(self0 uint32, result *cm.Result[IPSocketAddressShape, network.IPSocketAddress, network.ErrorCode])
// SendBufferSize represents the imported method "send-buffer-size".
//
// send-buffer-size: func() -> result<u64, error-code>
//
//go:nosplit
-func (self UDPSocket) SendBufferSize() (result cm.OKResult[uint64, network.ErrorCode]) {
+func (self UDPSocket) SendBufferSize() (result cm.Result[uint64, uint64, network.ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
wasmimport_UDPSocketSendBufferSize((uint32)(self0), &result)
return
@@ -215,14 +215,14 @@ func (self UDPSocket) SendBufferSize() (result cm.OKResult[uint64, network.Error
//go:wasmimport wasi:sockets/[email protected] [method]udp-socket.send-buffer-size
//go:noescape
-func wasmimport_UDPSocketSendBufferSize(self0 uint32, result *cm.OKResult[uint64, network.ErrorCode])
+func wasmimport_UDPSocketSendBufferSize(self0 uint32, result *cm.Result[uint64, uint64, network.ErrorCode])
// SetReceiveBufferSize represents the imported method "set-receive-buffer-size".
//
// set-receive-buffer-size: func(value: u64) -> result<_, error-code>
//
//go:nosplit
-func (self UDPSocket) SetReceiveBufferSize(value uint64) (result cm.ErrResult[struct{}, network.ErrorCode]) {
+func (self UDPSocket) SetReceiveBufferSize(value uint64) (result cm.Result[network.ErrorCode, struct{}, network.ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
value0 := (uint64)(value)
wasmimport_UDPSocketSetReceiveBufferSize((uint32)(self0), (uint64)(value0), &result)
@@ -231,14 +231,14 @@ func (self UDPSocket) SetReceiveBufferSize(value uint64) (result cm.ErrResult[st
//go:wasmimport wasi:sockets/[email protected] [method]udp-socket.set-receive-buffer-size
//go:noescape
-func wasmimport_UDPSocketSetReceiveBufferSize(self0 uint32, value0 uint64, result *cm.ErrResult[struct{}, network.ErrorCode])
+func wasmimport_UDPSocketSetReceiveBufferSize(self0 uint32, value0 uint64, result *cm.Result[network.ErrorCode, struct{}, network.ErrorCode])
// SetSendBufferSize represents the imported method "set-send-buffer-size".
//
// set-send-buffer-size: func(value: u64) -> result<_, error-code>
//
//go:nosplit
-func (self UDPSocket) SetSendBufferSize(value uint64) (result cm.ErrResult[struct{}, network.ErrorCode]) {
+func (self UDPSocket) SetSendBufferSize(value uint64) (result cm.Result[network.ErrorCode, struct{}, network.ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
value0 := (uint64)(value)
wasmimport_UDPSocketSetSendBufferSize((uint32)(self0), (uint64)(value0), &result)
@@ -247,14 +247,14 @@ func (self UDPSocket) SetSendBufferSize(value uint64) (result cm.ErrResult[struc
//go:wasmimport wasi:sockets/[email protected] [method]udp-socket.set-send-buffer-size
//go:noescape
-func wasmimport_UDPSocketSetSendBufferSize(self0 uint32, value0 uint64, result *cm.ErrResult[struct{}, network.ErrorCode])
+func wasmimport_UDPSocketSetSendBufferSize(self0 uint32, value0 uint64, result *cm.Result[network.ErrorCode, struct{}, network.ErrorCode])
// SetUnicastHopLimit represents the imported method "set-unicast-hop-limit".
//
// set-unicast-hop-limit: func(value: u8) -> result<_, error-code>
//
//go:nosplit
-func (self UDPSocket) SetUnicastHopLimit(value uint8) (result cm.ErrResult[struct{}, network.ErrorCode]) {
+func (self UDPSocket) SetUnicastHopLimit(value uint8) (result cm.Result[network.ErrorCode, struct{}, network.ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
value0 := (uint32)(value)
wasmimport_UDPSocketSetUnicastHopLimit((uint32)(self0), (uint32)(value0), &result)
@@ -263,7 +263,7 @@ func (self UDPSocket) SetUnicastHopLimit(value uint8) (result cm.ErrResult[struc
//go:wasmimport wasi:sockets/[email protected] [method]udp-socket.set-unicast-hop-limit
//go:noescape
-func wasmimport_UDPSocketSetUnicastHopLimit(self0 uint32, value0 uint32, result *cm.ErrResult[struct{}, network.ErrorCode])
+func wasmimport_UDPSocketSetUnicastHopLimit(self0 uint32, value0 uint32, result *cm.Result[network.ErrorCode, struct{}, network.ErrorCode])
// StartBind represents the imported method "start-bind".
//
@@ -303,7 +303,7 @@ func wasmimport_UDPSocketSetUnicastHopLimit(self0 uint32, value0 uint32, result
// result<_, error-code>
//
//go:nosplit
-func (self UDPSocket) StartBind(network_ network.Network, localAddress network.IPSocketAddress) (result cm.ErrResult[struct{}, network.ErrorCode]) {
+func (self UDPSocket) StartBind(network_ network.Network, localAddress network.IPSocketAddress) (result cm.Result[network.ErrorCode, struct{}, network.ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
network0 := cm.Reinterpret[uint32](network_)
localAddress0, localAddress1, localAddress2, localAddress3, localAddress4, localAddress5, localAddress6, localAddress7, localAddress8, localAddress9, localAddress10, localAddress11 := lower_IPSocketAddress(localAddress)
@@ -313,7 +313,7 @@ func (self UDPSocket) StartBind(network_ network.Network, localAddress network.I
//go:wasmimport wasi:sockets/[email protected] [method]udp-socket.start-bind
//go:noescape
-func wasmimport_UDPSocketStartBind(self0 uint32, network0 uint32, localAddress0 uint32, localAddress1 uint32, localAddress2 uint32, localAddress3 uint32, localAddress4 uint32, localAddress5 uint32, localAddress6 uint32, localAddress7 uint32, localAddress8 uint32, localAddress9 uint32, localAddress10 uint32, localAddress11 uint32, result *cm.ErrResult[struct{}, network.ErrorCode])
+func wasmimport_UDPSocketStartBind(self0 uint32, network0 uint32, localAddress0 uint32, localAddress1 uint32, localAddress2 uint32, localAddress3 uint32, localAddress4 uint32, localAddress5 uint32, localAddress6 uint32, localAddress7 uint32, localAddress8 uint32, localAddress9 uint32, localAddress10 uint32, localAddress11 uint32, result *cm.Result[network.ErrorCode, struct{}, network.ErrorCode])
// Stream represents the imported method "stream".
//
@@ -372,7 +372,7 @@ func wasmimport_UDPSocketStartBind(self0 uint32, network0 uint32, localAddress0
// outgoing-datagram-stream>, error-code>
//
//go:nosplit
-func (self UDPSocket) Stream(remoteAddress cm.Option[network.IPSocketAddress]) (result cm.OKResult[cm.Tuple[IncomingDatagramStream, OutgoingDatagramStream], network.ErrorCode]) {
+func (self UDPSocket) Stream(remoteAddress cm.Option[network.IPSocketAddress]) (result cm.Result[TupleIncomingDatagramStreamOutgoingDatagramStreamShape, cm.Tuple[IncomingDatagramStream, OutgoingDatagramStream], network.ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
remoteAddress0, remoteAddress1, remoteAddress2, remoteAddress3, remoteAddress4, remoteAddress5, remoteAddress6, remoteAddress7, remoteAddress8, remoteAddress9, remoteAddress10, remoteAddress11, remoteAddress12 := lower_OptionIPSocketAddress(remoteAddress)
wasmimport_UDPSocketStream((uint32)(self0), (uint32)(remoteAddress0), (uint32)(remoteAddress1), (uint32)(remoteAddress2), (uint32)(remoteAddress3), (uint32)(remoteAddress4), (uint32)(remoteAddress5), (uint32)(remoteAddress6), (uint32)(remoteAddress7), (uint32)(remoteAddress8), (uint32)(remoteAddress9), (uint32)(remoteAddress10), (uint32)(remoteAddress11), (uint32)(remoteAddress12), &result)
@@ -381,7 +381,7 @@ func (self UDPSocket) Stream(remoteAddress cm.Option[network.IPSocketAddress]) (
//go:wasmimport wasi:sockets/[email protected] [method]udp-socket.stream
//go:noescape
-func wasmimport_UDPSocketStream(self0 uint32, remoteAddress0 uint32, remoteAddress1 uint32, remoteAddress2 uint32, remoteAddress3 uint32, remoteAddress4 uint32, remoteAddress5 uint32, remoteAddress6 uint32, remoteAddress7 uint32, remoteAddress8 uint32, remoteAddress9 uint32, remoteAddress10 uint32, remoteAddress11 uint32, remoteAddress12 uint32, result *cm.OKResult[cm.Tuple[IncomingDatagramStream, OutgoingDatagramStream], network.ErrorCode])
+func wasmimport_UDPSocketStream(self0 uint32, remoteAddress0 uint32, remoteAddress1 uint32, remoteAddress2 uint32, remoteAddress3 uint32, remoteAddress4 uint32, remoteAddress5 uint32, remoteAddress6 uint32, remoteAddress7 uint32, remoteAddress8 uint32, remoteAddress9 uint32, remoteAddress10 uint32, remoteAddress11 uint32, remoteAddress12 uint32, result *cm.Result[TupleIncomingDatagramStreamOutgoingDatagramStreamShape, cm.Tuple[IncomingDatagramStream, OutgoingDatagramStream], network.ErrorCode])
// Subscribe represents the imported method "subscribe".
//
@@ -416,7 +416,7 @@ func wasmimport_UDPSocketSubscribe(self0 uint32) (result0 uint32)
// unicast-hop-limit: func() -> result<u8, error-code>
//
//go:nosplit
-func (self UDPSocket) UnicastHopLimit() (result cm.OKResult[uint8, network.ErrorCode]) {
+func (self UDPSocket) UnicastHopLimit() (result cm.Result[uint8, uint8, network.ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
wasmimport_UDPSocketUnicastHopLimit((uint32)(self0), &result)
return
@@ -424,7 +424,7 @@ func (self UDPSocket) UnicastHopLimit() (result cm.OKResult[uint8, network.Error
//go:wasmimport wasi:sockets/[email protected] [method]udp-socket.unicast-hop-limit
//go:noescape
-func wasmimport_UDPSocketUnicastHopLimit(self0 uint32, result *cm.OKResult[uint8, network.ErrorCode])
+func wasmimport_UDPSocketUnicastHopLimit(self0 uint32, result *cm.Result[uint8, uint8, network.ErrorCode])
// IncomingDatagramStream represents the imported resource "wasi:sockets/[email protected]#incoming-datagram-stream".
//
@@ -477,7 +477,7 @@ func wasmimport_IncomingDatagramStreamResourceDrop(self0 uint32)
// receive: func(max-results: u64) -> result<list<incoming-datagram>, error-code>
//
//go:nosplit
-func (self IncomingDatagramStream) Receive(maxResults uint64) (result cm.OKResult[cm.List[IncomingDatagram], network.ErrorCode]) {
+func (self IncomingDatagramStream) Receive(maxResults uint64) (result cm.Result[cm.List[IncomingDatagram], cm.List[IncomingDatagram], network.ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
maxResults0 := (uint64)(maxResults)
wasmimport_IncomingDatagramStreamReceive((uint32)(self0), (uint64)(maxResults0), &result)
@@ -486,7 +486,7 @@ func (self IncomingDatagramStream) Receive(maxResults uint64) (result cm.OKResul
//go:wasmimport wasi:sockets/[email protected] [method]incoming-datagram-stream.receive
//go:noescape
-func wasmimport_IncomingDatagramStreamReceive(self0 uint32, maxResults0 uint64, result *cm.OKResult[cm.List[IncomingDatagram], network.ErrorCode])
+func wasmimport_IncomingDatagramStreamReceive(self0 uint32, maxResults0 uint64, result *cm.Result[cm.List[IncomingDatagram], cm.List[IncomingDatagram], network.ErrorCode])
// Subscribe represents the imported method "subscribe".
//
@@ -546,7 +546,7 @@ func wasmimport_OutgoingDatagramStreamResourceDrop(self0 uint32)
// check-send: func() -> result<u64, error-code>
//
//go:nosplit
-func (self OutgoingDatagramStream) CheckSend() (result cm.OKResult[uint64, network.ErrorCode]) {
+func (self OutgoingDatagramStream) CheckSend() (result cm.Result[uint64, uint64, network.ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
wasmimport_OutgoingDatagramStreamCheckSend((uint32)(self0), &result)
return
@@ -554,7 +554,7 @@ func (self OutgoingDatagramStream) CheckSend() (result cm.OKResult[uint64, netwo
//go:wasmimport wasi:sockets/[email protected] [method]outgoing-datagram-stream.check-send
//go:noescape
-func wasmimport_OutgoingDatagramStreamCheckSend(self0 uint32, result *cm.OKResult[uint64, network.ErrorCode])
+func wasmimport_OutgoingDatagramStreamCheckSend(self0 uint32, result *cm.Result[uint64, uint64, network.ErrorCode])
// Send represents the imported method "send".
//
@@ -610,7 +610,7 @@ func wasmimport_OutgoingDatagramStreamCheckSend(self0 uint32, result *cm.OKResul
// send: func(datagrams: list<outgoing-datagram>) -> result<u64, error-code>
//
//go:nosplit
-func (self OutgoingDatagramStream) Send(datagrams cm.List[OutgoingDatagram]) (result cm.OKResult[uint64, network.ErrorCode]) {
+func (self OutgoingDatagramStream) Send(datagrams cm.List[OutgoingDatagram]) (result cm.Result[uint64, uint64, network.ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
datagrams0, datagrams1 := cm.LowerList(datagrams)
wasmimport_OutgoingDatagramStreamSend((uint32)(self0), (*OutgoingDatagram)(datagrams0), (uint32)(datagrams1), &result)
@@ -619,7 +619,7 @@ func (self OutgoingDatagramStream) Send(datagrams cm.List[OutgoingDatagram]) (re
//go:wasmimport wasi:sockets/[email protected] [method]outgoing-datagram-stream.send
//go:noescape
-func wasmimport_OutgoingDatagramStreamSend(self0 uint32, datagrams0 *OutgoingDatagram, datagrams1 uint32, result *cm.OKResult[uint64, network.ErrorCode])
+func wasmimport_OutgoingDatagramStreamSend(self0 uint32, datagrams0 *OutgoingDatagram, datagrams1 uint32, result *cm.Result[uint64, uint64, network.ErrorCode])
// Subscribe represents the imported method "subscribe".
//
diff --git a/src/vendor/github.com/ydnar/wasm-tools-go b/src/vendor/github.com/ydnar/wasm-tools-go
-Subproject ca8d06b46fa45bdc90b76060fc9bbf7ab9af5ee
+Subproject 49f7d9208ece21e46a1232189d664d649524b8c