mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-07-26 06:38:42 +00:00
internal/wasi: regenerate WASI 0.2 bindings
Use go.bytecodealliance.org/cmd/wit-bindgen-go@v0.6.0
This commit is contained in:
File diff suppressed because it is too large
Load Diff
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
+1
-1
@@ -15,7 +15,7 @@ import (
|
||||
//
|
||||
//go:nosplit
|
||||
func Exit(status cm.BoolResult) {
|
||||
status0 := cm.BoolToU32(status)
|
||||
status0 := (uint32)(cm.BoolToU32(status))
|
||||
wasmimport_Exit((uint32)(status0))
|
||||
return
|
||||
}
|
||||
|
||||
Regular → Executable
Regular → Executable
Regular → Executable
+1
-1
@@ -12,6 +12,6 @@ import (
|
||||
//export wasi:cli/run@0.2.0#run
|
||||
func wasmexport_Run() (result0 uint32) {
|
||||
result := Exports.Run()
|
||||
result0 = cm.BoolToU32(result)
|
||||
result0 = (uint32)(cm.BoolToU32(result))
|
||||
return
|
||||
}
|
||||
|
||||
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
+3
-3
@@ -31,9 +31,9 @@ import (
|
||||
// nanoseconds: u32,
|
||||
// }
|
||||
type DateTime struct {
|
||||
_ cm.HostLayout
|
||||
Seconds uint64
|
||||
Nanoseconds uint32
|
||||
_ cm.HostLayout `json:"-"`
|
||||
Seconds uint64 `json:"seconds"`
|
||||
Nanoseconds uint32 `json:"nanoseconds"`
|
||||
}
|
||||
|
||||
// Now represents the imported function "now".
|
||||
|
||||
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
+1
-1
@@ -30,7 +30,7 @@ func lower_NewTimestamp(v NewTimestamp) (f0 uint32, f1 uint64, f2 uint32) {
|
||||
f0 = (uint32)(v.Tag())
|
||||
switch f0 {
|
||||
case 2: // timestamp
|
||||
v1, v2 := lower_DateTime(*v.Timestamp())
|
||||
v1, v2 := lower_DateTime(*cm.Case[DateTime](&v, 2))
|
||||
f1 = (uint64)(v1)
|
||||
f2 = (uint32)(v2)
|
||||
}
|
||||
|
||||
Regular → Executable
Regular → Executable
Regular → Executable
+61
-22
@@ -106,7 +106,7 @@ const (
|
||||
DescriptorTypeSocket
|
||||
)
|
||||
|
||||
var stringsDescriptorType = [8]string{
|
||||
var _DescriptorTypeStrings = [8]string{
|
||||
"unknown",
|
||||
"block-device",
|
||||
"character-device",
|
||||
@@ -119,9 +119,22 @@ var stringsDescriptorType = [8]string{
|
||||
|
||||
// String implements [fmt.Stringer], returning the enum case name of e.
|
||||
func (e DescriptorType) String() string {
|
||||
return stringsDescriptorType[e]
|
||||
return _DescriptorTypeStrings[e]
|
||||
}
|
||||
|
||||
// MarshalText implements [encoding.TextMarshaler].
|
||||
func (e DescriptorType) MarshalText() ([]byte, error) {
|
||||
return []byte(e.String()), nil
|
||||
}
|
||||
|
||||
// UnmarshalText implements [encoding.TextUnmarshaler], unmarshaling into an enum
|
||||
// case. Returns an error if the supplied text is not one of the enum cases.
|
||||
func (e *DescriptorType) UnmarshalText(text []byte) error {
|
||||
return _DescriptorTypeUnmarshalCase(e, text)
|
||||
}
|
||||
|
||||
var _DescriptorTypeUnmarshalCase = cm.CaseUnmarshaler[DescriptorType](_DescriptorTypeStrings[:])
|
||||
|
||||
// DescriptorFlags represents the flags "wasi:filesystem/types@0.2.0#descriptor-flags".
|
||||
//
|
||||
// Descriptor flags.
|
||||
@@ -246,34 +259,34 @@ type LinkCount uint64
|
||||
// status-change-timestamp: option<datetime>,
|
||||
// }
|
||||
type DescriptorStat struct {
|
||||
_ cm.HostLayout
|
||||
_ cm.HostLayout `json:"-"`
|
||||
// File type.
|
||||
Type DescriptorType
|
||||
Type DescriptorType `json:"type"`
|
||||
|
||||
// Number of hard links to the file.
|
||||
LinkCount LinkCount
|
||||
LinkCount LinkCount `json:"link-count"`
|
||||
|
||||
// For regular files, the file size in bytes. For symbolic links, the
|
||||
// length in bytes of the pathname contained in the symbolic link.
|
||||
Size FileSize
|
||||
Size FileSize `json:"size"`
|
||||
|
||||
// Last data access timestamp.
|
||||
//
|
||||
// If the `option` is none, the platform doesn't maintain an access
|
||||
// timestamp for this file.
|
||||
DataAccessTimestamp cm.Option[DateTime]
|
||||
DataAccessTimestamp cm.Option[DateTime] `json:"data-access-timestamp"`
|
||||
|
||||
// Last data modification timestamp.
|
||||
//
|
||||
// If the `option` is none, the platform doesn't maintain a
|
||||
// modification timestamp for this file.
|
||||
DataModificationTimestamp cm.Option[DateTime]
|
||||
DataModificationTimestamp cm.Option[DateTime] `json:"data-modification-timestamp"`
|
||||
|
||||
// Last file status-change timestamp.
|
||||
//
|
||||
// If the `option` is none, the platform doesn't maintain a
|
||||
// status-change timestamp for this file.
|
||||
StatusChangeTimestamp cm.Option[DateTime]
|
||||
StatusChangeTimestamp cm.Option[DateTime] `json:"status-change-timestamp"`
|
||||
}
|
||||
|
||||
// NewTimestamp represents the variant "wasi:filesystem/types@0.2.0#new-timestamp".
|
||||
@@ -326,7 +339,7 @@ func (self *NewTimestamp) Timestamp() *DateTime {
|
||||
return cm.Case[DateTime](self, 2)
|
||||
}
|
||||
|
||||
var stringsNewTimestamp = [3]string{
|
||||
var _NewTimestampStrings = [3]string{
|
||||
"no-change",
|
||||
"now",
|
||||
"timestamp",
|
||||
@@ -334,7 +347,7 @@ var stringsNewTimestamp = [3]string{
|
||||
|
||||
// String implements [fmt.Stringer], returning the variant case name of v.
|
||||
func (v NewTimestamp) String() string {
|
||||
return stringsNewTimestamp[v.Tag()]
|
||||
return _NewTimestampStrings[v.Tag()]
|
||||
}
|
||||
|
||||
// DirectoryEntry represents the record "wasi:filesystem/types@0.2.0#directory-entry".
|
||||
@@ -346,12 +359,12 @@ func (v NewTimestamp) String() string {
|
||||
// name: string,
|
||||
// }
|
||||
type DirectoryEntry struct {
|
||||
_ cm.HostLayout
|
||||
_ cm.HostLayout `json:"-"`
|
||||
// The type of the file referred to by this directory entry.
|
||||
Type DescriptorType
|
||||
Type DescriptorType `json:"type"`
|
||||
|
||||
// The name of the object.
|
||||
Name string
|
||||
Name string `json:"name"`
|
||||
}
|
||||
|
||||
// ErrorCode represents the enum "wasi:filesystem/types@0.2.0#error-code".
|
||||
@@ -516,7 +529,7 @@ const (
|
||||
ErrorCodeCrossDevice
|
||||
)
|
||||
|
||||
var stringsErrorCode = [37]string{
|
||||
var _ErrorCodeStrings = [37]string{
|
||||
"access",
|
||||
"would-block",
|
||||
"already",
|
||||
@@ -558,9 +571,22 @@ var stringsErrorCode = [37]string{
|
||||
|
||||
// String implements [fmt.Stringer], returning the enum case name of e.
|
||||
func (e ErrorCode) String() string {
|
||||
return stringsErrorCode[e]
|
||||
return _ErrorCodeStrings[e]
|
||||
}
|
||||
|
||||
// MarshalText implements [encoding.TextMarshaler].
|
||||
func (e ErrorCode) MarshalText() ([]byte, error) {
|
||||
return []byte(e.String()), nil
|
||||
}
|
||||
|
||||
// UnmarshalText implements [encoding.TextUnmarshaler], unmarshaling into an enum
|
||||
// case. Returns an error if the supplied text is not one of the enum cases.
|
||||
func (e *ErrorCode) UnmarshalText(text []byte) error {
|
||||
return _ErrorCodeUnmarshalCase(e, text)
|
||||
}
|
||||
|
||||
var _ErrorCodeUnmarshalCase = cm.CaseUnmarshaler[ErrorCode](_ErrorCodeStrings[:])
|
||||
|
||||
// Advice represents the enum "wasi:filesystem/types@0.2.0#advice".
|
||||
//
|
||||
// File or memory access pattern advisory information.
|
||||
@@ -601,7 +627,7 @@ const (
|
||||
AdviceNoReuse
|
||||
)
|
||||
|
||||
var stringsAdvice = [6]string{
|
||||
var _AdviceStrings = [6]string{
|
||||
"normal",
|
||||
"sequential",
|
||||
"random",
|
||||
@@ -612,9 +638,22 @@ var stringsAdvice = [6]string{
|
||||
|
||||
// String implements [fmt.Stringer], returning the enum case name of e.
|
||||
func (e Advice) String() string {
|
||||
return stringsAdvice[e]
|
||||
return _AdviceStrings[e]
|
||||
}
|
||||
|
||||
// MarshalText implements [encoding.TextMarshaler].
|
||||
func (e Advice) MarshalText() ([]byte, error) {
|
||||
return []byte(e.String()), nil
|
||||
}
|
||||
|
||||
// UnmarshalText implements [encoding.TextUnmarshaler], unmarshaling into an enum
|
||||
// case. Returns an error if the supplied text is not one of the enum cases.
|
||||
func (e *Advice) UnmarshalText(text []byte) error {
|
||||
return _AdviceUnmarshalCase(e, text)
|
||||
}
|
||||
|
||||
var _AdviceUnmarshalCase = cm.CaseUnmarshaler[Advice](_AdviceStrings[:])
|
||||
|
||||
// MetadataHashValue represents the record "wasi:filesystem/types@0.2.0#metadata-hash-value".
|
||||
//
|
||||
// A 128-bit hash value, split into parts because wasm doesn't have a
|
||||
@@ -625,12 +664,12 @@ func (e Advice) String() string {
|
||||
// upper: u64,
|
||||
// }
|
||||
type MetadataHashValue struct {
|
||||
_ cm.HostLayout
|
||||
_ cm.HostLayout `json:"-"`
|
||||
// 64 bits of a 128-bit hash value.
|
||||
Lower uint64
|
||||
Lower uint64 `json:"lower"`
|
||||
|
||||
// Another 64 bits of a 128-bit hash value.
|
||||
Upper uint64
|
||||
Upper uint64 `json:"upper"`
|
||||
}
|
||||
|
||||
// Descriptor represents the imported resource "wasi:filesystem/types@0.2.0#descriptor".
|
||||
@@ -761,7 +800,7 @@ func (self Descriptor) IsSameObject(other Descriptor) (result bool) {
|
||||
self0 := cm.Reinterpret[uint32](self)
|
||||
other0 := cm.Reinterpret[uint32](other)
|
||||
result0 := wasmimport_DescriptorIsSameObject((uint32)(self0), (uint32)(other0))
|
||||
result = cm.U32ToBool((uint32)(result0))
|
||||
result = (bool)(cm.U32ToBool((uint32)(result0)))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
+1
-1
@@ -57,7 +57,7 @@ func (self Pollable) Block() {
|
||||
func (self Pollable) Ready() (result bool) {
|
||||
self0 := cm.Reinterpret[uint32](self)
|
||||
result0 := wasmimport_PollableReady((uint32)(self0))
|
||||
result = cm.U32ToBool((uint32)(result0))
|
||||
result = (bool)(cm.U32ToBool((uint32)(result0)))
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
||||
|
||||
package streams
|
||||
|
||||
import (
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// StreamErrorShape is used for storage in variant or result types.
|
||||
type StreamErrorShape struct {
|
||||
shape [unsafe.Sizeof(StreamError{})]byte
|
||||
}
|
||||
Regular → Executable
Regular → Executable
Regular → Executable
+15
-15
@@ -64,14 +64,14 @@ func (self *StreamError) Closed() bool {
|
||||
return self.Tag() == 1
|
||||
}
|
||||
|
||||
var stringsStreamError = [2]string{
|
||||
var _StreamErrorStrings = [2]string{
|
||||
"last-operation-failed",
|
||||
"closed",
|
||||
}
|
||||
|
||||
// String implements [fmt.Stringer], returning the variant case name of v.
|
||||
func (v StreamError) String() string {
|
||||
return stringsStreamError[v.Tag()]
|
||||
return _StreamErrorStrings[v.Tag()]
|
||||
}
|
||||
|
||||
// InputStream represents the imported resource "wasi:io/streams@0.2.0#input-stream".
|
||||
@@ -273,13 +273,13 @@ func (self OutputStream) BlockingSplice(src InputStream, len_ uint64) (result cm
|
||||
//
|
||||
// let pollable = this.subscribe();
|
||||
// while !contents.is_empty() {
|
||||
// // Wait for the stream to become writable
|
||||
// pollable.block();
|
||||
// let Ok(n) = this.check-write(); // eliding error handling
|
||||
// let len = min(n, contents.len());
|
||||
// let (chunk, rest) = contents.split_at(len);
|
||||
// this.write(chunk ); // eliding error handling
|
||||
// contents = rest;
|
||||
// // Wait for the stream to become writable
|
||||
// pollable.block();
|
||||
// let Ok(n) = this.check-write(); // eliding error handling
|
||||
// let len = min(n, contents.len());
|
||||
// let (chunk, rest) = contents.split_at(len);
|
||||
// this.write(chunk ); // eliding error handling
|
||||
// contents = rest;
|
||||
// }
|
||||
// this.flush();
|
||||
// // Wait for completion of `flush`
|
||||
@@ -309,12 +309,12 @@ func (self OutputStream) BlockingWriteAndFlush(contents cm.List[uint8]) (result
|
||||
//
|
||||
// let pollable = this.subscribe();
|
||||
// while num_zeroes != 0 {
|
||||
// // Wait for the stream to become writable
|
||||
// pollable.block();
|
||||
// let Ok(n) = this.check-write(); // eliding error handling
|
||||
// let len = min(n, num_zeroes);
|
||||
// this.write-zeroes(len); // eliding error handling
|
||||
// num_zeroes -= len;
|
||||
// // Wait for the stream to become writable
|
||||
// pollable.block();
|
||||
// let Ok(n) = this.check-write(); // eliding error handling
|
||||
// let len = min(n, num_zeroes);
|
||||
// this.write-zeroes(len); // eliding error handling
|
||||
// num_zeroes -= len;
|
||||
// }
|
||||
// this.flush();
|
||||
// // Wait for completion of `flush`
|
||||
|
||||
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
+42
-16
@@ -153,7 +153,7 @@ const (
|
||||
ErrorCodePermanentResolverFailure
|
||||
)
|
||||
|
||||
var stringsErrorCode = [21]string{
|
||||
var _ErrorCodeStrings = [21]string{
|
||||
"unknown",
|
||||
"access-denied",
|
||||
"not-supported",
|
||||
@@ -179,9 +179,22 @@ var stringsErrorCode = [21]string{
|
||||
|
||||
// String implements [fmt.Stringer], returning the enum case name of e.
|
||||
func (e ErrorCode) String() string {
|
||||
return stringsErrorCode[e]
|
||||
return _ErrorCodeStrings[e]
|
||||
}
|
||||
|
||||
// MarshalText implements [encoding.TextMarshaler].
|
||||
func (e ErrorCode) MarshalText() ([]byte, error) {
|
||||
return []byte(e.String()), nil
|
||||
}
|
||||
|
||||
// UnmarshalText implements [encoding.TextUnmarshaler], unmarshaling into an enum
|
||||
// case. Returns an error if the supplied text is not one of the enum cases.
|
||||
func (e *ErrorCode) UnmarshalText(text []byte) error {
|
||||
return _ErrorCodeUnmarshalCase(e, text)
|
||||
}
|
||||
|
||||
var _ErrorCodeUnmarshalCase = cm.CaseUnmarshaler[ErrorCode](_ErrorCodeStrings[:])
|
||||
|
||||
// IPAddressFamily represents the enum "wasi:sockets/network@0.2.0#ip-address-family".
|
||||
//
|
||||
// enum ip-address-family {
|
||||
@@ -198,16 +211,29 @@ const (
|
||||
IPAddressFamilyIPv6
|
||||
)
|
||||
|
||||
var stringsIPAddressFamily = [2]string{
|
||||
var _IPAddressFamilyStrings = [2]string{
|
||||
"ipv4",
|
||||
"ipv6",
|
||||
}
|
||||
|
||||
// String implements [fmt.Stringer], returning the enum case name of e.
|
||||
func (e IPAddressFamily) String() string {
|
||||
return stringsIPAddressFamily[e]
|
||||
return _IPAddressFamilyStrings[e]
|
||||
}
|
||||
|
||||
// MarshalText implements [encoding.TextMarshaler].
|
||||
func (e IPAddressFamily) MarshalText() ([]byte, error) {
|
||||
return []byte(e.String()), nil
|
||||
}
|
||||
|
||||
// UnmarshalText implements [encoding.TextUnmarshaler], unmarshaling into an enum
|
||||
// case. Returns an error if the supplied text is not one of the enum cases.
|
||||
func (e *IPAddressFamily) UnmarshalText(text []byte) error {
|
||||
return _IPAddressFamilyUnmarshalCase(e, text)
|
||||
}
|
||||
|
||||
var _IPAddressFamilyUnmarshalCase = cm.CaseUnmarshaler[IPAddressFamily](_IPAddressFamilyStrings[:])
|
||||
|
||||
// IPv4Address represents the tuple "wasi:sockets/network@0.2.0#ipv4-address".
|
||||
//
|
||||
// type ipv4-address = tuple<u8, u8, u8, u8>
|
||||
@@ -246,14 +272,14 @@ func (self *IPAddress) IPv6() *IPv6Address {
|
||||
return cm.Case[IPv6Address](self, 1)
|
||||
}
|
||||
|
||||
var stringsIPAddress = [2]string{
|
||||
var _IPAddressStrings = [2]string{
|
||||
"ipv4",
|
||||
"ipv6",
|
||||
}
|
||||
|
||||
// String implements [fmt.Stringer], returning the variant case name of v.
|
||||
func (v IPAddress) String() string {
|
||||
return stringsIPAddress[v.Tag()]
|
||||
return _IPAddressStrings[v.Tag()]
|
||||
}
|
||||
|
||||
// IPv4SocketAddress represents the record "wasi:sockets/network@0.2.0#ipv4-socket-address".
|
||||
@@ -263,12 +289,12 @@ func (v IPAddress) String() string {
|
||||
// address: ipv4-address,
|
||||
// }
|
||||
type IPv4SocketAddress struct {
|
||||
_ cm.HostLayout
|
||||
_ cm.HostLayout `json:"-"`
|
||||
// sin_port
|
||||
Port uint16
|
||||
Port uint16 `json:"port"`
|
||||
|
||||
// sin_addr
|
||||
Address IPv4Address
|
||||
Address IPv4Address `json:"address"`
|
||||
}
|
||||
|
||||
// IPv6SocketAddress represents the record "wasi:sockets/network@0.2.0#ipv6-socket-address".
|
||||
@@ -280,18 +306,18 @@ type IPv4SocketAddress struct {
|
||||
// scope-id: u32,
|
||||
// }
|
||||
type IPv6SocketAddress struct {
|
||||
_ cm.HostLayout
|
||||
_ cm.HostLayout `json:"-"`
|
||||
// sin6_port
|
||||
Port uint16
|
||||
Port uint16 `json:"port"`
|
||||
|
||||
// sin6_flowinfo
|
||||
FlowInfo uint32
|
||||
FlowInfo uint32 `json:"flow-info"`
|
||||
|
||||
// sin6_addr
|
||||
Address IPv6Address
|
||||
Address IPv6Address `json:"address"`
|
||||
|
||||
// sin6_scope_id
|
||||
ScopeID uint32
|
||||
ScopeID uint32 `json:"scope-id"`
|
||||
}
|
||||
|
||||
// IPSocketAddress represents the variant "wasi:sockets/network@0.2.0#ip-socket-address".
|
||||
@@ -322,12 +348,12 @@ func (self *IPSocketAddress) IPv6() *IPv6SocketAddress {
|
||||
return cm.Case[IPv6SocketAddress](self, 1)
|
||||
}
|
||||
|
||||
var stringsIPSocketAddress = [2]string{
|
||||
var _IPSocketAddressStrings = [2]string{
|
||||
"ipv4",
|
||||
"ipv6",
|
||||
}
|
||||
|
||||
// String implements [fmt.Stringer], returning the variant case name of v.
|
||||
func (v IPSocketAddress) String() string {
|
||||
return stringsIPSocketAddress[v.Tag()]
|
||||
return _IPSocketAddressStrings[v.Tag()]
|
||||
}
|
||||
|
||||
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
+3
-3
@@ -23,7 +23,7 @@ type TupleInputStreamOutputStreamShape struct {
|
||||
// IPSocketAddressShape is used for storage in variant or result types.
|
||||
type IPSocketAddressShape struct {
|
||||
_ cm.HostLayout
|
||||
shape [unsafe.Sizeof(network.IPSocketAddress{})]byte
|
||||
shape [unsafe.Sizeof(IPSocketAddress{})]byte
|
||||
}
|
||||
|
||||
func lower_IPv4Address(v network.IPv4Address) (f0 uint32, f1 uint32, f2 uint32, f3 uint32) {
|
||||
@@ -64,14 +64,14 @@ func lower_IPSocketAddress(v network.IPSocketAddress) (f0 uint32, f1 uint32, f2
|
||||
f0 = (uint32)(v.Tag())
|
||||
switch f0 {
|
||||
case 0: // ipv4
|
||||
v1, v2, v3, v4, v5 := lower_IPv4SocketAddress(*v.IPv4())
|
||||
v1, v2, v3, v4, v5 := lower_IPv4SocketAddress(*cm.Case[network.IPv4SocketAddress](&v, 0))
|
||||
f1 = (uint32)(v1)
|
||||
f2 = (uint32)(v2)
|
||||
f3 = (uint32)(v3)
|
||||
f4 = (uint32)(v4)
|
||||
f5 = (uint32)(v5)
|
||||
case 1: // ipv6
|
||||
v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11 := lower_IPv6SocketAddress(*v.IPv6())
|
||||
v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11 := lower_IPv6SocketAddress(*cm.Case[network.IPv6SocketAddress](&v, 1))
|
||||
f1 = (uint32)(v1)
|
||||
f2 = (uint32)(v2)
|
||||
f3 = (uint32)(v3)
|
||||
|
||||
Regular → Executable
Regular → Executable
+1
-1
@@ -46,7 +46,7 @@ func wasmimport_TCPSocketKeepAliveCount(self0 uint32, result *cm.Result[uint32,
|
||||
|
||||
//go:wasmimport wasi:sockets/tcp@0.2.0 [method]tcp-socket.keep-alive-enabled
|
||||
//go:noescape
|
||||
func wasmimport_TCPSocketKeepAliveEnabled(self0 uint32, result *cm.Result[bool, bool, ErrorCode])
|
||||
func wasmimport_TCPSocketKeepAliveEnabled(self0 uint32, result *cm.Result[ErrorCode, bool, ErrorCode])
|
||||
|
||||
//go:wasmimport wasi:sockets/tcp@0.2.0 [method]tcp-socket.keep-alive-idle-time
|
||||
//go:noescape
|
||||
|
||||
Regular → Executable
+18
-5
@@ -71,7 +71,7 @@ const (
|
||||
ShutdownTypeBoth
|
||||
)
|
||||
|
||||
var stringsShutdownType = [3]string{
|
||||
var _ShutdownTypeStrings = [3]string{
|
||||
"receive",
|
||||
"send",
|
||||
"both",
|
||||
@@ -79,9 +79,22 @@ var stringsShutdownType = [3]string{
|
||||
|
||||
// String implements [fmt.Stringer], returning the enum case name of e.
|
||||
func (e ShutdownType) String() string {
|
||||
return stringsShutdownType[e]
|
||||
return _ShutdownTypeStrings[e]
|
||||
}
|
||||
|
||||
// MarshalText implements [encoding.TextMarshaler].
|
||||
func (e ShutdownType) MarshalText() ([]byte, error) {
|
||||
return []byte(e.String()), nil
|
||||
}
|
||||
|
||||
// UnmarshalText implements [encoding.TextUnmarshaler], unmarshaling into an enum
|
||||
// case. Returns an error if the supplied text is not one of the enum cases.
|
||||
func (e *ShutdownType) UnmarshalText(text []byte) error {
|
||||
return _ShutdownTypeUnmarshalCase(e, text)
|
||||
}
|
||||
|
||||
var _ShutdownTypeUnmarshalCase = cm.CaseUnmarshaler[ShutdownType](_ShutdownTypeStrings[:])
|
||||
|
||||
// TCPSocket represents the imported resource "wasi:sockets/tcp@0.2.0#tcp-socket".
|
||||
//
|
||||
// A TCP socket resource.
|
||||
@@ -241,7 +254,7 @@ func (self TCPSocket) HopLimit() (result cm.Result[uint8, uint8, ErrorCode]) {
|
||||
func (self TCPSocket) IsListening() (result bool) {
|
||||
self0 := cm.Reinterpret[uint32](self)
|
||||
result0 := wasmimport_TCPSocketIsListening((uint32)(self0))
|
||||
result = cm.U32ToBool((uint32)(result0))
|
||||
result = (bool)(cm.U32ToBool((uint32)(result0)))
|
||||
return
|
||||
}
|
||||
|
||||
@@ -285,7 +298,7 @@ func (self TCPSocket) KeepAliveCount() (result cm.Result[uint32, uint32, ErrorCo
|
||||
// keep-alive-enabled: func() -> result<bool, error-code>
|
||||
//
|
||||
//go:nosplit
|
||||
func (self TCPSocket) KeepAliveEnabled() (result cm.Result[bool, bool, ErrorCode]) {
|
||||
func (self TCPSocket) KeepAliveEnabled() (result cm.Result[ErrorCode, bool, ErrorCode]) {
|
||||
self0 := cm.Reinterpret[uint32](self)
|
||||
wasmimport_TCPSocketKeepAliveEnabled((uint32)(self0), &result)
|
||||
return
|
||||
@@ -457,7 +470,7 @@ func (self TCPSocket) SetKeepAliveCount(value uint32) (result cm.Result[ErrorCod
|
||||
//go:nosplit
|
||||
func (self TCPSocket) SetKeepAliveEnabled(value bool) (result cm.Result[ErrorCode, struct{}, ErrorCode]) {
|
||||
self0 := cm.Reinterpret[uint32](self)
|
||||
value0 := cm.BoolToU32(value)
|
||||
value0 := (uint32)(cm.BoolToU32(value))
|
||||
wasmimport_TCPSocketSetKeepAliveEnabled((uint32)(self0), (uint32)(value0), &result)
|
||||
return
|
||||
}
|
||||
|
||||
Regular → Executable
Regular → Executable
Regular → Executable
Regular → Executable
+3
-3
@@ -11,7 +11,7 @@ import (
|
||||
// IPSocketAddressShape is used for storage in variant or result types.
|
||||
type IPSocketAddressShape struct {
|
||||
_ cm.HostLayout
|
||||
shape [unsafe.Sizeof(network.IPSocketAddress{})]byte
|
||||
shape [unsafe.Sizeof(IPSocketAddress{})]byte
|
||||
}
|
||||
|
||||
func lower_IPv4Address(v network.IPv4Address) (f0 uint32, f1 uint32, f2 uint32, f3 uint32) {
|
||||
@@ -52,14 +52,14 @@ func lower_IPSocketAddress(v network.IPSocketAddress) (f0 uint32, f1 uint32, f2
|
||||
f0 = (uint32)(v.Tag())
|
||||
switch f0 {
|
||||
case 0: // ipv4
|
||||
v1, v2, v3, v4, v5 := lower_IPv4SocketAddress(*v.IPv4())
|
||||
v1, v2, v3, v4, v5 := lower_IPv4SocketAddress(*cm.Case[network.IPv4SocketAddress](&v, 0))
|
||||
f1 = (uint32)(v1)
|
||||
f2 = (uint32)(v2)
|
||||
f3 = (uint32)(v3)
|
||||
f4 = (uint32)(v4)
|
||||
f5 = (uint32)(v5)
|
||||
case 1: // ipv6
|
||||
v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11 := lower_IPv6SocketAddress(*v.IPv6())
|
||||
v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11 := lower_IPv6SocketAddress(*cm.Case[network.IPv6SocketAddress](&v, 1))
|
||||
f1 = (uint32)(v1)
|
||||
f2 = (uint32)(v2)
|
||||
f3 = (uint32)(v3)
|
||||
|
||||
Regular → Executable
Regular → Executable
Regular → Executable
+8
-8
@@ -43,11 +43,11 @@ type IPAddressFamily = network.IPAddressFamily
|
||||
// remote-address: ip-socket-address,
|
||||
// }
|
||||
type IncomingDatagram struct {
|
||||
_ cm.HostLayout
|
||||
_ cm.HostLayout `json:"-"`
|
||||
// The payload.
|
||||
//
|
||||
// Theoretical max size: ~64 KiB. In practice, typically less than 1500 bytes.
|
||||
Data cm.List[uint8]
|
||||
Data cm.List[uint8] `json:"data"`
|
||||
|
||||
// The source address.
|
||||
//
|
||||
@@ -55,7 +55,7 @@ type IncomingDatagram struct {
|
||||
// with, if any.
|
||||
//
|
||||
// Equivalent to the `src_addr` out parameter of `recvfrom`.
|
||||
RemoteAddress IPSocketAddress
|
||||
RemoteAddress IPSocketAddress `json:"remote-address"`
|
||||
}
|
||||
|
||||
// OutgoingDatagram represents the record "wasi:sockets/udp@0.2.0#outgoing-datagram".
|
||||
@@ -67,9 +67,9 @@ type IncomingDatagram struct {
|
||||
// remote-address: option<ip-socket-address>,
|
||||
// }
|
||||
type OutgoingDatagram struct {
|
||||
_ cm.HostLayout
|
||||
_ cm.HostLayout `json:"-"`
|
||||
// The payload.
|
||||
Data cm.List[uint8]
|
||||
Data cm.List[uint8] `json:"data"`
|
||||
|
||||
// The destination address.
|
||||
//
|
||||
@@ -80,7 +80,7 @@ type OutgoingDatagram struct {
|
||||
//
|
||||
// If this value is None, the send operation is equivalent to `send` in POSIX. Otherwise
|
||||
// it is equivalent to `sendto`.
|
||||
RemoteAddress cm.Option[IPSocketAddress]
|
||||
RemoteAddress cm.Option[IPSocketAddress] `json:"remote-address"`
|
||||
}
|
||||
|
||||
// UDPSocket represents the imported resource "wasi:sockets/udp@0.2.0#udp-socket".
|
||||
@@ -321,10 +321,10 @@ func (self UDPSocket) StartBind(network_ Network, localAddress IPSocketAddress)
|
||||
// The POSIX equivalent in pseudo-code is:
|
||||
//
|
||||
// if (was previously connected) {
|
||||
// connect(s, AF_UNSPEC)
|
||||
// connect(s, AF_UNSPEC)
|
||||
// }
|
||||
// if (remote_address is Some) {
|
||||
// connect(s, remote_address)
|
||||
// connect(s, remote_address)
|
||||
// }
|
||||
//
|
||||
// Unlike in POSIX, the socket must already be explicitly bound.
|
||||
|
||||
Reference in New Issue
Block a user