generated dependencies

This commit is contained in:
Lorenzo Venerandi 2024-12-14 01:30:44 +01:00
parent 9a788f9858
commit 5974f6eef7
124 changed files with 7502 additions and 1 deletions

1
.gitignore vendored
View File

@ -1,4 +1,3 @@
gen/*
build/* build/*
creds.json creds.json

View File

@ -0,0 +1,3 @@
// This file exists for testing this package without WebAssembly,
// allowing empty function bodies with a //go:wasmimport directive.
// See https://pkg.go.dev/cmd/compile for more information.

View File

@ -0,0 +1,21 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
package environment
import (
"github.com/bytecodealliance/wasm-tools-go/cm"
)
// This file contains wasmimport and wasmexport declarations for "wasi:cli@0.2.0".
//go:wasmimport wasi:cli/environment@0.2.0 get-environment
//go:noescape
func wasmimport_GetEnvironment(result *cm.List[[2]string])
//go:wasmimport wasi:cli/environment@0.2.0 get-arguments
//go:noescape
func wasmimport_GetArguments(result *cm.List[string])
//go:wasmimport wasi:cli/environment@0.2.0 initial-cwd
//go:noescape
func wasmimport_InitialCWD(result *cm.Option[string])

View File

@ -0,0 +1,38 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
// Package environment represents the imported interface "wasi:cli/environment@0.2.0".
package environment
import (
"github.com/bytecodealliance/wasm-tools-go/cm"
)
// GetEnvironment represents the imported function "get-environment".
//
// get-environment: func() -> list<tuple<string, string>>
//
//go:nosplit
func GetEnvironment() (result cm.List[[2]string]) {
wasmimport_GetEnvironment(&result)
return
}
// GetArguments represents the imported function "get-arguments".
//
// get-arguments: func() -> list<string>
//
//go:nosplit
func GetArguments() (result cm.List[string]) {
wasmimport_GetArguments(&result)
return
}
// InitialCWD represents the imported function "initial-cwd".
//
// initial-cwd: func() -> option<string>
//
//go:nosplit
func InitialCWD() (result cm.Option[string]) {
wasmimport_InitialCWD(&result)
return
}

View File

@ -0,0 +1,3 @@
// This file exists for testing this package without WebAssembly,
// allowing empty function bodies with a //go:wasmimport directive.
// See https://pkg.go.dev/cmd/compile for more information.

View File

@ -0,0 +1,9 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
package exit
// This file contains wasmimport and wasmexport declarations for "wasi:cli@0.2.0".
//go:wasmimport wasi:cli/exit@0.2.0 exit
//go:noescape
func wasmimport_Exit(status0 uint32)

View File

@ -0,0 +1,19 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
// Package exit represents the imported interface "wasi:cli/exit@0.2.0".
package exit
import (
"github.com/bytecodealliance/wasm-tools-go/cm"
)
// Exit represents the imported function "exit".
//
// exit: func(status: result)
//
//go:nosplit
func Exit(status cm.BoolResult) {
status0 := cm.BoolToU32(status)
wasmimport_Exit((uint32)(status0))
return
}

View File

@ -0,0 +1,3 @@
// This file exists for testing this package without WebAssembly,
// allowing empty function bodies with a //go:wasmimport directive.
// See https://pkg.go.dev/cmd/compile for more information.

View File

@ -0,0 +1,9 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
package stderr
// This file contains wasmimport and wasmexport declarations for "wasi:cli@0.2.0".
//go:wasmimport wasi:cli/stderr@0.2.0 get-stderr
//go:noescape
func wasmimport_GetStderr() (result0 uint32)

View File

@ -0,0 +1,25 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
// Package stderr represents the imported interface "wasi:cli/stderr@0.2.0".
package stderr
import (
"gitea.rebus.ninja/lore/go-nats-client/gen/wasi/io/streams"
"github.com/bytecodealliance/wasm-tools-go/cm"
)
// OutputStream represents the imported type alias "wasi:cli/stderr@0.2.0#output-stream".
//
// See [streams.OutputStream] for more information.
type OutputStream = streams.OutputStream
// GetStderr represents the imported function "get-stderr".
//
// get-stderr: func() -> output-stream
//
//go:nosplit
func GetStderr() (result OutputStream) {
result0 := wasmimport_GetStderr()
result = cm.Reinterpret[OutputStream]((uint32)(result0))
return
}

View File

@ -0,0 +1,3 @@
// This file exists for testing this package without WebAssembly,
// allowing empty function bodies with a //go:wasmimport directive.
// See https://pkg.go.dev/cmd/compile for more information.

View File

@ -0,0 +1,9 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
package stdin
// This file contains wasmimport and wasmexport declarations for "wasi:cli@0.2.0".
//go:wasmimport wasi:cli/stdin@0.2.0 get-stdin
//go:noescape
func wasmimport_GetStdin() (result0 uint32)

View File

@ -0,0 +1,25 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
// Package stdin represents the imported interface "wasi:cli/stdin@0.2.0".
package stdin
import (
"gitea.rebus.ninja/lore/go-nats-client/gen/wasi/io/streams"
"github.com/bytecodealliance/wasm-tools-go/cm"
)
// InputStream represents the imported type alias "wasi:cli/stdin@0.2.0#input-stream".
//
// See [streams.InputStream] for more information.
type InputStream = streams.InputStream
// GetStdin represents the imported function "get-stdin".
//
// get-stdin: func() -> input-stream
//
//go:nosplit
func GetStdin() (result InputStream) {
result0 := wasmimport_GetStdin()
result = cm.Reinterpret[InputStream]((uint32)(result0))
return
}

View File

@ -0,0 +1,3 @@
// This file exists for testing this package without WebAssembly,
// allowing empty function bodies with a //go:wasmimport directive.
// See https://pkg.go.dev/cmd/compile for more information.

View File

@ -0,0 +1,9 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
package stdout
// This file contains wasmimport and wasmexport declarations for "wasi:cli@0.2.0".
//go:wasmimport wasi:cli/stdout@0.2.0 get-stdout
//go:noescape
func wasmimport_GetStdout() (result0 uint32)

View File

@ -0,0 +1,25 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
// Package stdout represents the imported interface "wasi:cli/stdout@0.2.0".
package stdout
import (
"gitea.rebus.ninja/lore/go-nats-client/gen/wasi/io/streams"
"github.com/bytecodealliance/wasm-tools-go/cm"
)
// OutputStream represents the imported type alias "wasi:cli/stdout@0.2.0#output-stream".
//
// See [streams.OutputStream] for more information.
type OutputStream = streams.OutputStream
// GetStdout represents the imported function "get-stdout".
//
// get-stdout: func() -> output-stream
//
//go:nosplit
func GetStdout() (result OutputStream) {
result0 := wasmimport_GetStdout()
result = cm.Reinterpret[OutputStream]((uint32)(result0))
return
}

View File

@ -0,0 +1,3 @@
// This file exists for testing this package without WebAssembly,
// allowing empty function bodies with a //go:wasmimport directive.
// See https://pkg.go.dev/cmd/compile for more information.

View File

@ -0,0 +1,24 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
// Package terminalinput represents the imported interface "wasi:cli/terminal-input@0.2.0".
package terminalinput
import (
"github.com/bytecodealliance/wasm-tools-go/cm"
)
// TerminalInput represents the imported resource "wasi:cli/terminal-input@0.2.0#terminal-input".
//
// resource terminal-input
type TerminalInput cm.Resource
// ResourceDrop represents the imported resource-drop for resource "terminal-input".
//
// Drops a resource handle.
//
//go:nosplit
func (self TerminalInput) ResourceDrop() {
self0 := cm.Reinterpret[uint32](self)
wasmimport_TerminalInputResourceDrop((uint32)(self0))
return
}

View File

@ -0,0 +1,9 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
package terminalinput
// This file contains wasmimport and wasmexport declarations for "wasi:cli@0.2.0".
//go:wasmimport wasi:cli/terminal-input@0.2.0 [resource-drop]terminal-input
//go:noescape
func wasmimport_TerminalInputResourceDrop(self0 uint32)

View File

@ -0,0 +1,3 @@
// This file exists for testing this package without WebAssembly,
// allowing empty function bodies with a //go:wasmimport directive.
// See https://pkg.go.dev/cmd/compile for more information.

View File

@ -0,0 +1,24 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
// Package terminaloutput represents the imported interface "wasi:cli/terminal-output@0.2.0".
package terminaloutput
import (
"github.com/bytecodealliance/wasm-tools-go/cm"
)
// TerminalOutput represents the imported resource "wasi:cli/terminal-output@0.2.0#terminal-output".
//
// resource terminal-output
type TerminalOutput cm.Resource
// ResourceDrop represents the imported resource-drop for resource "terminal-output".
//
// Drops a resource handle.
//
//go:nosplit
func (self TerminalOutput) ResourceDrop() {
self0 := cm.Reinterpret[uint32](self)
wasmimport_TerminalOutputResourceDrop((uint32)(self0))
return
}

View File

@ -0,0 +1,9 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
package terminaloutput
// This file contains wasmimport and wasmexport declarations for "wasi:cli@0.2.0".
//go:wasmimport wasi:cli/terminal-output@0.2.0 [resource-drop]terminal-output
//go:noescape
func wasmimport_TerminalOutputResourceDrop(self0 uint32)

View File

@ -0,0 +1,3 @@
// This file exists for testing this package without WebAssembly,
// allowing empty function bodies with a //go:wasmimport directive.
// See https://pkg.go.dev/cmd/compile for more information.

View File

@ -0,0 +1,24 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
// Package terminalstderr represents the imported interface "wasi:cli/terminal-stderr@0.2.0".
package terminalstderr
import (
terminaloutput "gitea.rebus.ninja/lore/go-nats-client/gen/wasi/cli/terminal-output"
"github.com/bytecodealliance/wasm-tools-go/cm"
)
// TerminalOutput represents the imported type alias "wasi:cli/terminal-stderr@0.2.0#terminal-output".
//
// See [terminaloutput.TerminalOutput] for more information.
type TerminalOutput = terminaloutput.TerminalOutput
// GetTerminalStderr represents the imported function "get-terminal-stderr".
//
// get-terminal-stderr: func() -> option<terminal-output>
//
//go:nosplit
func GetTerminalStderr() (result cm.Option[TerminalOutput]) {
wasmimport_GetTerminalStderr(&result)
return
}

View File

@ -0,0 +1,13 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
package terminalstderr
import (
"github.com/bytecodealliance/wasm-tools-go/cm"
)
// This file contains wasmimport and wasmexport declarations for "wasi:cli@0.2.0".
//go:wasmimport wasi:cli/terminal-stderr@0.2.0 get-terminal-stderr
//go:noescape
func wasmimport_GetTerminalStderr(result *cm.Option[TerminalOutput])

View File

@ -0,0 +1,3 @@
// This file exists for testing this package without WebAssembly,
// allowing empty function bodies with a //go:wasmimport directive.
// See https://pkg.go.dev/cmd/compile for more information.

View File

@ -0,0 +1,24 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
// Package terminalstdin represents the imported interface "wasi:cli/terminal-stdin@0.2.0".
package terminalstdin
import (
terminalinput "gitea.rebus.ninja/lore/go-nats-client/gen/wasi/cli/terminal-input"
"github.com/bytecodealliance/wasm-tools-go/cm"
)
// TerminalInput represents the imported type alias "wasi:cli/terminal-stdin@0.2.0#terminal-input".
//
// See [terminalinput.TerminalInput] for more information.
type TerminalInput = terminalinput.TerminalInput
// GetTerminalStdin represents the imported function "get-terminal-stdin".
//
// get-terminal-stdin: func() -> option<terminal-input>
//
//go:nosplit
func GetTerminalStdin() (result cm.Option[TerminalInput]) {
wasmimport_GetTerminalStdin(&result)
return
}

View File

@ -0,0 +1,13 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
package terminalstdin
import (
"github.com/bytecodealliance/wasm-tools-go/cm"
)
// This file contains wasmimport and wasmexport declarations for "wasi:cli@0.2.0".
//go:wasmimport wasi:cli/terminal-stdin@0.2.0 get-terminal-stdin
//go:noescape
func wasmimport_GetTerminalStdin(result *cm.Option[TerminalInput])

View File

@ -0,0 +1,3 @@
// This file exists for testing this package without WebAssembly,
// allowing empty function bodies with a //go:wasmimport directive.
// See https://pkg.go.dev/cmd/compile for more information.

View File

@ -0,0 +1,24 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
// Package terminalstdout represents the imported interface "wasi:cli/terminal-stdout@0.2.0".
package terminalstdout
import (
terminaloutput "gitea.rebus.ninja/lore/go-nats-client/gen/wasi/cli/terminal-output"
"github.com/bytecodealliance/wasm-tools-go/cm"
)
// TerminalOutput represents the imported type alias "wasi:cli/terminal-stdout@0.2.0#terminal-output".
//
// See [terminaloutput.TerminalOutput] for more information.
type TerminalOutput = terminaloutput.TerminalOutput
// GetTerminalStdout represents the imported function "get-terminal-stdout".
//
// get-terminal-stdout: func() -> option<terminal-output>
//
//go:nosplit
func GetTerminalStdout() (result cm.Option[TerminalOutput]) {
wasmimport_GetTerminalStdout(&result)
return
}

View File

@ -0,0 +1,13 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
package terminalstdout
import (
"github.com/bytecodealliance/wasm-tools-go/cm"
)
// This file contains wasmimport and wasmexport declarations for "wasi:cli@0.2.0".
//go:wasmimport wasi:cli/terminal-stdout@0.2.0 get-terminal-stdout
//go:noescape
func wasmimport_GetTerminalStdout(result *cm.Option[TerminalOutput])

View File

@ -0,0 +1,3 @@
// This file exists for testing this package without WebAssembly,
// allowing empty function bodies with a //go:wasmimport directive.
// See https://pkg.go.dev/cmd/compile for more information.

View File

@ -0,0 +1,70 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
// Package monotonicclock represents the imported interface "wasi:clocks/monotonic-clock@0.2.0".
package monotonicclock
import (
"gitea.rebus.ninja/lore/go-nats-client/gen/wasi/io/poll"
"github.com/bytecodealliance/wasm-tools-go/cm"
)
// Pollable represents the imported type alias "wasi:clocks/monotonic-clock@0.2.0#pollable".
//
// See [poll.Pollable] for more information.
type Pollable = poll.Pollable
// Instant represents the u64 "wasi:clocks/monotonic-clock@0.2.0#instant".
//
// type instant = u64
type Instant uint64
// Duration represents the u64 "wasi:clocks/monotonic-clock@0.2.0#duration".
//
// type duration = u64
type Duration uint64
// Now represents the imported function "now".
//
// now: func() -> instant
//
//go:nosplit
func Now() (result Instant) {
result0 := wasmimport_Now()
result = (Instant)((uint64)(result0))
return
}
// Resolution represents the imported function "resolution".
//
// resolution: func() -> duration
//
//go:nosplit
func Resolution() (result Duration) {
result0 := wasmimport_Resolution()
result = (Duration)((uint64)(result0))
return
}
// SubscribeInstant represents the imported function "subscribe-instant".
//
// subscribe-instant: func(when: instant) -> pollable
//
//go:nosplit
func SubscribeInstant(when Instant) (result Pollable) {
when0 := (uint64)(when)
result0 := wasmimport_SubscribeInstant((uint64)(when0))
result = cm.Reinterpret[Pollable]((uint32)(result0))
return
}
// SubscribeDuration represents the imported function "subscribe-duration".
//
// subscribe-duration: func(when: duration) -> pollable
//
//go:nosplit
func SubscribeDuration(when Duration) (result Pollable) {
when0 := (uint64)(when)
result0 := wasmimport_SubscribeDuration((uint64)(when0))
result = cm.Reinterpret[Pollable]((uint32)(result0))
return
}

View File

@ -0,0 +1,21 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
package monotonicclock
// This file contains wasmimport and wasmexport declarations for "wasi:clocks@0.2.0".
//go:wasmimport wasi:clocks/monotonic-clock@0.2.0 now
//go:noescape
func wasmimport_Now() (result0 uint64)
//go:wasmimport wasi:clocks/monotonic-clock@0.2.0 resolution
//go:noescape
func wasmimport_Resolution() (result0 uint64)
//go:wasmimport wasi:clocks/monotonic-clock@0.2.0 subscribe-instant
//go:noescape
func wasmimport_SubscribeInstant(when0 uint64) (result0 uint32)
//go:wasmimport wasi:clocks/monotonic-clock@0.2.0 subscribe-duration
//go:noescape
func wasmimport_SubscribeDuration(when0 uint64) (result0 uint32)

View File

@ -0,0 +1,3 @@
// This file exists for testing this package without WebAssembly,
// allowing empty function bodies with a //go:wasmimport directive.
// See https://pkg.go.dev/cmd/compile for more information.

View File

@ -0,0 +1,40 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
// Package wallclock represents the imported interface "wasi:clocks/wall-clock@0.2.0".
package wallclock
import (
"github.com/bytecodealliance/wasm-tools-go/cm"
)
// DateTime represents the record "wasi:clocks/wall-clock@0.2.0#datetime".
//
// record datetime {
// seconds: u64,
// nanoseconds: u32,
// }
type DateTime struct {
_ cm.HostLayout
Seconds uint64
Nanoseconds uint32
}
// Now represents the imported function "now".
//
// now: func() -> datetime
//
//go:nosplit
func Now() (result DateTime) {
wasmimport_Now(&result)
return
}
// Resolution represents the imported function "resolution".
//
// resolution: func() -> datetime
//
//go:nosplit
func Resolution() (result DateTime) {
wasmimport_Resolution(&result)
return
}

View File

@ -0,0 +1,13 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
package wallclock
// This file contains wasmimport and wasmexport declarations for "wasi:clocks@0.2.0".
//go:wasmimport wasi:clocks/wall-clock@0.2.0 now
//go:noescape
func wasmimport_Now(result *DateTime)
//go:wasmimport wasi:clocks/wall-clock@0.2.0 resolution
//go:noescape
func wasmimport_Resolution(result *DateTime)

View File

@ -0,0 +1,20 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
package runtime
import (
"github.com/bytecodealliance/wasm-tools-go/cm"
"unsafe"
)
// OptionStringShape is used for storage in variant or result types.
type OptionStringShape struct {
_ cm.HostLayout
shape [unsafe.Sizeof(cm.Option[string]{})]byte
}
// ConfigErrorShape is used for storage in variant or result types.
type ConfigErrorShape struct {
_ cm.HostLayout
shape [unsafe.Sizeof(ConfigError{})]byte
}

View File

@ -0,0 +1,3 @@
// This file exists for testing this package without WebAssembly,
// allowing empty function bodies with a //go:wasmimport directive.
// See https://pkg.go.dev/cmd/compile for more information.

View File

@ -0,0 +1,17 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
package runtime
import (
"github.com/bytecodealliance/wasm-tools-go/cm"
)
// This file contains wasmimport and wasmexport declarations for "wasi:config@0.2.0-draft".
//go:wasmimport wasi:config/runtime@0.2.0-draft get
//go:noescape
func wasmimport_Get(key0 *uint8, key1 uint32, result *cm.Result[OptionStringShape, cm.Option[string], ConfigError])
//go:wasmimport wasi:config/runtime@0.2.0-draft get-all
//go:noescape
func wasmimport_GetAll(result *cm.Result[ConfigErrorShape, cm.List[[2]string], ConfigError])

View File

@ -0,0 +1,67 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
// Package runtime represents the imported interface "wasi:config/runtime@0.2.0-draft".
package runtime
import (
"github.com/bytecodealliance/wasm-tools-go/cm"
)
// ConfigError represents the variant "wasi:config/runtime@0.2.0-draft#config-error".
//
// variant config-error {
// upstream(string),
// io(string),
// }
type ConfigError cm.Variant[uint8, string, string]
// ConfigErrorUpstream returns a [ConfigError] of case "upstream".
func ConfigErrorUpstream(data string) ConfigError {
return cm.New[ConfigError](0, data)
}
// Upstream returns a non-nil *[string] if [ConfigError] represents the variant case "upstream".
func (self *ConfigError) Upstream() *string {
return cm.Case[string](self, 0)
}
// ConfigErrorIO returns a [ConfigError] of case "io".
func ConfigErrorIO(data string) ConfigError {
return cm.New[ConfigError](1, data)
}
// IO returns a non-nil *[string] if [ConfigError] represents the variant case "io".
func (self *ConfigError) IO() *string {
return cm.Case[string](self, 1)
}
var stringsConfigError = [2]string{
"upstream",
"io",
}
// String implements [fmt.Stringer], returning the variant case name of v.
func (v ConfigError) String() string {
return stringsConfigError[v.Tag()]
}
// Get represents the imported function "get".
//
// get: func(key: string) -> result<option<string>, config-error>
//
//go:nosplit
func Get(key string) (result cm.Result[OptionStringShape, cm.Option[string], ConfigError]) {
key0, key1 := cm.LowerString(key)
wasmimport_Get((*uint8)(key0), (uint32)(key1), &result)
return
}
// GetAll represents the imported function "get-all".
//
// get-all: func() -> result<list<tuple<string, string>>, config-error>
//
//go:nosplit
func GetAll() (result cm.Result[ConfigErrorShape, cm.List[[2]string], ConfigError]) {
wasmimport_GetAll(&result)
return
}

View File

@ -0,0 +1,3 @@
// This file exists for testing this package without WebAssembly,
// allowing empty function bodies with a //go:wasmimport directive.
// See https://pkg.go.dev/cmd/compile for more information.

View File

@ -0,0 +1,13 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
package preopens
import (
"github.com/bytecodealliance/wasm-tools-go/cm"
)
// This file contains wasmimport and wasmexport declarations for "wasi:filesystem@0.2.0".
//go:wasmimport wasi:filesystem/preopens@0.2.0 get-directories
//go:noescape
func wasmimport_GetDirectories(result *cm.List[cm.Tuple[Descriptor, string]])

View File

@ -0,0 +1,24 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
// Package preopens represents the imported interface "wasi:filesystem/preopens@0.2.0".
package preopens
import (
"gitea.rebus.ninja/lore/go-nats-client/gen/wasi/filesystem/types"
"github.com/bytecodealliance/wasm-tools-go/cm"
)
// Descriptor represents the imported type alias "wasi:filesystem/preopens@0.2.0#descriptor".
//
// See [types.Descriptor] for more information.
type Descriptor = types.Descriptor
// GetDirectories represents the imported function "get-directories".
//
// get-directories: func() -> list<tuple<descriptor, string>>
//
//go:nosplit
func GetDirectories() (result cm.List[cm.Tuple[Descriptor, string]]) {
wasmimport_GetDirectories(&result)
return
}

View File

@ -0,0 +1,50 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
package types
import (
wallclock "gitea.rebus.ninja/lore/go-nats-client/gen/wasi/clocks/wall-clock"
"github.com/bytecodealliance/wasm-tools-go/cm"
"unsafe"
)
// MetadataHashValueShape is used for storage in variant or result types.
type MetadataHashValueShape struct {
_ cm.HostLayout
shape [unsafe.Sizeof(MetadataHashValue{})]byte
}
// TupleListU8BoolShape is used for storage in variant or result types.
type TupleListU8BoolShape struct {
_ cm.HostLayout
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)
return
}
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())
f1 = (uint64)(v1)
f2 = (uint32)(v2)
}
return
}
// DescriptorStatShape is used for storage in variant or result types.
type DescriptorStatShape struct {
_ cm.HostLayout
shape [unsafe.Sizeof(DescriptorStat{})]byte
}
// OptionDirectoryEntryShape is used for storage in variant or result types.
type OptionDirectoryEntryShape struct {
_ cm.HostLayout
shape [unsafe.Sizeof(cm.Option[DirectoryEntry]{})]byte
}

View File

@ -0,0 +1,3 @@
// This file exists for testing this package without WebAssembly,
// allowing empty function bodies with a //go:wasmimport directive.
// See https://pkg.go.dev/cmd/compile for more information.

View File

@ -0,0 +1,133 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
package types
import (
"github.com/bytecodealliance/wasm-tools-go/cm"
)
// This file contains wasmimport and wasmexport declarations for "wasi:filesystem@0.2.0".
//go:wasmimport wasi:filesystem/types@0.2.0 [resource-drop]descriptor
//go:noescape
func wasmimport_DescriptorResourceDrop(self0 uint32)
//go:wasmimport wasi:filesystem/types@0.2.0 [method]descriptor.advise
//go:noescape
func wasmimport_DescriptorAdvise(self0 uint32, offset0 uint64, length0 uint64, advice0 uint32, result *cm.Result[ErrorCode, struct{}, ErrorCode])
//go:wasmimport wasi:filesystem/types@0.2.0 [method]descriptor.append-via-stream
//go:noescape
func wasmimport_DescriptorAppendViaStream(self0 uint32, result *cm.Result[OutputStream, OutputStream, ErrorCode])
//go:wasmimport wasi:filesystem/types@0.2.0 [method]descriptor.create-directory-at
//go:noescape
func wasmimport_DescriptorCreateDirectoryAt(self0 uint32, path0 *uint8, path1 uint32, result *cm.Result[ErrorCode, struct{}, ErrorCode])
//go:wasmimport wasi:filesystem/types@0.2.0 [method]descriptor.get-flags
//go:noescape
func wasmimport_DescriptorGetFlags(self0 uint32, result *cm.Result[DescriptorFlags, DescriptorFlags, ErrorCode])
//go:wasmimport wasi:filesystem/types@0.2.0 [method]descriptor.get-type
//go:noescape
func wasmimport_DescriptorGetType(self0 uint32, result *cm.Result[DescriptorType, DescriptorType, ErrorCode])
//go:wasmimport wasi:filesystem/types@0.2.0 [method]descriptor.is-same-object
//go:noescape
func wasmimport_DescriptorIsSameObject(self0 uint32, other0 uint32) (result0 uint32)
//go:wasmimport wasi:filesystem/types@0.2.0 [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.Result[ErrorCode, struct{}, ErrorCode])
//go:wasmimport wasi:filesystem/types@0.2.0 [method]descriptor.metadata-hash
//go:noescape
func wasmimport_DescriptorMetadataHash(self0 uint32, result *cm.Result[MetadataHashValueShape, MetadataHashValue, ErrorCode])
//go:wasmimport wasi:filesystem/types@0.2.0 [method]descriptor.metadata-hash-at
//go:noescape
func wasmimport_DescriptorMetadataHashAt(self0 uint32, pathFlags0 uint32, path0 *uint8, path1 uint32, result *cm.Result[MetadataHashValueShape, MetadataHashValue, ErrorCode])
//go:wasmimport wasi:filesystem/types@0.2.0 [method]descriptor.open-at
//go:noescape
func wasmimport_DescriptorOpenAt(self0 uint32, pathFlags0 uint32, path0 *uint8, path1 uint32, openFlags0 uint32, flags0 uint32, result *cm.Result[Descriptor, Descriptor, ErrorCode])
//go:wasmimport wasi:filesystem/types@0.2.0 [method]descriptor.read
//go:noescape
func wasmimport_DescriptorRead(self0 uint32, length0 uint64, offset0 uint64, result *cm.Result[TupleListU8BoolShape, cm.Tuple[cm.List[uint8], bool], ErrorCode])
//go:wasmimport wasi:filesystem/types@0.2.0 [method]descriptor.read-directory
//go:noescape
func wasmimport_DescriptorReadDirectory(self0 uint32, result *cm.Result[DirectoryEntryStream, DirectoryEntryStream, ErrorCode])
//go:wasmimport wasi:filesystem/types@0.2.0 [method]descriptor.read-via-stream
//go:noescape
func wasmimport_DescriptorReadViaStream(self0 uint32, offset0 uint64, result *cm.Result[InputStream, InputStream, ErrorCode])
//go:wasmimport wasi:filesystem/types@0.2.0 [method]descriptor.readlink-at
//go:noescape
func wasmimport_DescriptorReadLinkAt(self0 uint32, path0 *uint8, path1 uint32, result *cm.Result[string, string, ErrorCode])
//go:wasmimport wasi:filesystem/types@0.2.0 [method]descriptor.remove-directory-at
//go:noescape
func wasmimport_DescriptorRemoveDirectoryAt(self0 uint32, path0 *uint8, path1 uint32, result *cm.Result[ErrorCode, struct{}, ErrorCode])
//go:wasmimport wasi:filesystem/types@0.2.0 [method]descriptor.rename-at
//go:noescape
func wasmimport_DescriptorRenameAt(self0 uint32, oldPath0 *uint8, oldPath1 uint32, newDescriptor0 uint32, newPath0 *uint8, newPath1 uint32, result *cm.Result[ErrorCode, struct{}, ErrorCode])
//go:wasmimport wasi:filesystem/types@0.2.0 [method]descriptor.set-size
//go:noescape
func wasmimport_DescriptorSetSize(self0 uint32, size0 uint64, result *cm.Result[ErrorCode, struct{}, ErrorCode])
//go:wasmimport wasi:filesystem/types@0.2.0 [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.Result[ErrorCode, struct{}, ErrorCode])
//go:wasmimport wasi:filesystem/types@0.2.0 [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.Result[ErrorCode, struct{}, ErrorCode])
//go:wasmimport wasi:filesystem/types@0.2.0 [method]descriptor.stat
//go:noescape
func wasmimport_DescriptorStat(self0 uint32, result *cm.Result[DescriptorStatShape, DescriptorStat, ErrorCode])
//go:wasmimport wasi:filesystem/types@0.2.0 [method]descriptor.stat-at
//go:noescape
func wasmimport_DescriptorStatAt(self0 uint32, pathFlags0 uint32, path0 *uint8, path1 uint32, result *cm.Result[DescriptorStatShape, DescriptorStat, ErrorCode])
//go:wasmimport wasi:filesystem/types@0.2.0 [method]descriptor.symlink-at
//go:noescape
func wasmimport_DescriptorSymlinkAt(self0 uint32, oldPath0 *uint8, oldPath1 uint32, newPath0 *uint8, newPath1 uint32, result *cm.Result[ErrorCode, struct{}, ErrorCode])
//go:wasmimport wasi:filesystem/types@0.2.0 [method]descriptor.sync
//go:noescape
func wasmimport_DescriptorSync(self0 uint32, result *cm.Result[ErrorCode, struct{}, ErrorCode])
//go:wasmimport wasi:filesystem/types@0.2.0 [method]descriptor.sync-data
//go:noescape
func wasmimport_DescriptorSyncData(self0 uint32, result *cm.Result[ErrorCode, struct{}, ErrorCode])
//go:wasmimport wasi:filesystem/types@0.2.0 [method]descriptor.unlink-file-at
//go:noescape
func wasmimport_DescriptorUnlinkFileAt(self0 uint32, path0 *uint8, path1 uint32, result *cm.Result[ErrorCode, struct{}, ErrorCode])
//go:wasmimport wasi:filesystem/types@0.2.0 [method]descriptor.write
//go:noescape
func wasmimport_DescriptorWrite(self0 uint32, buffer0 *uint8, buffer1 uint32, offset0 uint64, result *cm.Result[uint64, FileSize, ErrorCode])
//go:wasmimport wasi:filesystem/types@0.2.0 [method]descriptor.write-via-stream
//go:noescape
func wasmimport_DescriptorWriteViaStream(self0 uint32, offset0 uint64, result *cm.Result[OutputStream, OutputStream, ErrorCode])
//go:wasmimport wasi:filesystem/types@0.2.0 [resource-drop]directory-entry-stream
//go:noescape
func wasmimport_DirectoryEntryStreamResourceDrop(self0 uint32)
//go:wasmimport wasi:filesystem/types@0.2.0 [method]directory-entry-stream.read-directory-entry
//go:noescape
func wasmimport_DirectoryEntryStreamReadDirectoryEntry(self0 uint32, result *cm.Result[OptionDirectoryEntryShape, cm.Option[DirectoryEntry], ErrorCode])
//go:wasmimport wasi:filesystem/types@0.2.0 filesystem-error-code
//go:noescape
func wasmimport_FilesystemErrorCode(err0 uint32, result *cm.Option[ErrorCode])

View File

@ -0,0 +1,787 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
// Package types represents the imported interface "wasi:filesystem/types@0.2.0".
package types
import (
wallclock "gitea.rebus.ninja/lore/go-nats-client/gen/wasi/clocks/wall-clock"
"gitea.rebus.ninja/lore/go-nats-client/gen/wasi/io/streams"
"github.com/bytecodealliance/wasm-tools-go/cm"
)
// InputStream represents the imported type alias "wasi:filesystem/types@0.2.0#input-stream".
//
// See [streams.InputStream] for more information.
type InputStream = streams.InputStream
// OutputStream represents the imported type alias "wasi:filesystem/types@0.2.0#output-stream".
//
// See [streams.OutputStream] for more information.
type OutputStream = streams.OutputStream
// Error represents the imported type alias "wasi:filesystem/types@0.2.0#error".
//
// See [streams.Error] for more information.
type Error = streams.Error
// DateTime represents the type alias "wasi:filesystem/types@0.2.0#datetime".
//
// See [wallclock.DateTime] for more information.
type DateTime = wallclock.DateTime
// FileSize represents the u64 "wasi:filesystem/types@0.2.0#filesize".
//
// type filesize = u64
type FileSize uint64
// DescriptorType represents the enum "wasi:filesystem/types@0.2.0#descriptor-type".
//
// enum descriptor-type {
// unknown,
// block-device,
// character-device,
// directory,
// fifo,
// symbolic-link,
// regular-file,
// socket
// }
type DescriptorType uint8
const (
DescriptorTypeUnknown DescriptorType = iota
DescriptorTypeBlockDevice
DescriptorTypeCharacterDevice
DescriptorTypeDirectory
DescriptorTypeFIFO
DescriptorTypeSymbolicLink
DescriptorTypeRegularFile
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/types@0.2.0#descriptor-flags".
//
// flags descriptor-flags {
// read,
// write,
// file-integrity-sync,
// data-integrity-sync,
// requested-write-sync,
// mutate-directory,
// }
type DescriptorFlags uint8
const (
DescriptorFlagsRead DescriptorFlags = 1 << iota
DescriptorFlagsWrite
DescriptorFlagsFileIntegritySync
DescriptorFlagsDataIntegritySync
DescriptorFlagsRequestedWriteSync
DescriptorFlagsMutateDirectory
)
// PathFlags represents the flags "wasi:filesystem/types@0.2.0#path-flags".
//
// flags path-flags {
// symlink-follow,
// }
type PathFlags uint8
const (
PathFlagsSymlinkFollow PathFlags = 1 << iota
)
// OpenFlags represents the flags "wasi:filesystem/types@0.2.0#open-flags".
//
// flags open-flags {
// create,
// directory,
// exclusive,
// truncate,
// }
type OpenFlags uint8
const (
OpenFlagsCreate OpenFlags = 1 << iota
OpenFlagsDirectory
OpenFlagsExclusive
OpenFlagsTruncate
)
// LinkCount represents the u64 "wasi:filesystem/types@0.2.0#link-count".
//
// type link-count = u64
type LinkCount uint64
// DescriptorStat represents the record "wasi:filesystem/types@0.2.0#descriptor-stat".
//
// record descriptor-stat {
// %type: descriptor-type,
// link-count: link-count,
// size: filesize,
// data-access-timestamp: option<datetime>,
// data-modification-timestamp: option<datetime>,
// status-change-timestamp: option<datetime>,
// }
type DescriptorStat struct {
_ cm.HostLayout
Type DescriptorType
LinkCount LinkCount
Size FileSize
DataAccessTimestamp cm.Option[DateTime]
DataModificationTimestamp cm.Option[DateTime]
StatusChangeTimestamp cm.Option[DateTime]
}
// NewTimestamp represents the variant "wasi:filesystem/types@0.2.0#new-timestamp".
//
// variant new-timestamp {
// no-change,
// now,
// timestamp(datetime),
// }
type NewTimestamp cm.Variant[uint8, DateTime, DateTime]
// NewTimestampNoChange returns a [NewTimestamp] of case "no-change".
func NewTimestampNoChange() NewTimestamp {
var data struct{}
return cm.New[NewTimestamp](0, data)
}
// NoChange returns true if [NewTimestamp] represents the variant case "no-change".
func (self *NewTimestamp) NoChange() bool {
return self.Tag() == 0
}
// NewTimestampNow returns a [NewTimestamp] of case "now".
func NewTimestampNow() NewTimestamp {
var data struct{}
return cm.New[NewTimestamp](1, data)
}
// Now returns true if [NewTimestamp] represents the variant case "now".
func (self *NewTimestamp) Now() bool {
return self.Tag() == 1
}
// NewTimestampTimestamp returns a [NewTimestamp] of case "timestamp".
func NewTimestampTimestamp(data DateTime) NewTimestamp {
return cm.New[NewTimestamp](2, data)
}
// Timestamp returns a non-nil *[DateTime] if [NewTimestamp] represents the variant case "timestamp".
func (self *NewTimestamp) Timestamp() *DateTime {
return cm.Case[DateTime](self, 2)
}
var stringsNewTimestamp = [3]string{
"no-change",
"now",
"timestamp",
}
// String implements [fmt.Stringer], returning the variant case name of v.
func (v NewTimestamp) String() string {
return stringsNewTimestamp[v.Tag()]
}
// DirectoryEntry represents the record "wasi:filesystem/types@0.2.0#directory-entry".
//
// record directory-entry {
// %type: descriptor-type,
// name: string,
// }
type DirectoryEntry struct {
_ cm.HostLayout
Type DescriptorType
Name string
}
// ErrorCode represents the enum "wasi:filesystem/types@0.2.0#error-code".
//
// enum error-code {
// 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
// }
type ErrorCode uint8
const (
ErrorCodeAccess ErrorCode = iota
ErrorCodeWouldBlock
ErrorCodeAlready
ErrorCodeBadDescriptor
ErrorCodeBusy
ErrorCodeDeadlock
ErrorCodeQuota
ErrorCodeExist
ErrorCodeFileTooLarge
ErrorCodeIllegalByteSequence
ErrorCodeInProgress
ErrorCodeInterrupted
ErrorCodeInvalid
ErrorCodeIO
ErrorCodeIsDirectory
ErrorCodeLoop
ErrorCodeTooManyLinks
ErrorCodeMessageSize
ErrorCodeNameTooLong
ErrorCodeNoDevice
ErrorCodeNoEntry
ErrorCodeNoLock
ErrorCodeInsufficientMemory
ErrorCodeInsufficientSpace
ErrorCodeNotDirectory
ErrorCodeNotEmpty
ErrorCodeNotRecoverable
ErrorCodeUnsupported
ErrorCodeNoTTY
ErrorCodeNoSuchDevice
ErrorCodeOverflow
ErrorCodeNotPermitted
ErrorCodePipe
ErrorCodeReadOnly
ErrorCodeInvalidSeek
ErrorCodeTextFileBusy
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/types@0.2.0#advice".
//
// enum advice {
// normal,
// sequential,
// random,
// will-need,
// dont-need,
// no-reuse
// }
type Advice uint8
const (
AdviceNormal Advice = iota
AdviceSequential
AdviceRandom
AdviceWillNeed
AdviceDontNeed
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/types@0.2.0#metadata-hash-value".
//
// record metadata-hash-value {
// lower: u64,
// upper: u64,
// }
type MetadataHashValue struct {
_ cm.HostLayout
Lower uint64
Upper uint64
}
// Descriptor represents the imported resource "wasi:filesystem/types@0.2.0#descriptor".
//
// resource descriptor
type Descriptor cm.Resource
// ResourceDrop represents the imported resource-drop for resource "descriptor".
//
// Drops a resource handle.
//
//go:nosplit
func (self Descriptor) ResourceDrop() {
self0 := cm.Reinterpret[uint32](self)
wasmimport_DescriptorResourceDrop((uint32)(self0))
return
}
// Advise represents the imported method "advise".
//
// 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.Result[ErrorCode, struct{}, ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
offset0 := (uint64)(offset)
length0 := (uint64)(length)
advice0 := (uint32)(advice)
wasmimport_DescriptorAdvise((uint32)(self0), (uint64)(offset0), (uint64)(length0), (uint32)(advice0), &result)
return
}
// AppendViaStream represents the imported method "append-via-stream".
//
// append-via-stream: func() -> result<output-stream, error-code>
//
//go:nosplit
func (self Descriptor) AppendViaStream() (result cm.Result[OutputStream, OutputStream, ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
wasmimport_DescriptorAppendViaStream((uint32)(self0), &result)
return
}
// CreateDirectoryAt represents the imported method "create-directory-at".
//
// create-directory-at: func(path: string) -> result<_, error-code>
//
//go:nosplit
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)
return
}
// GetFlags represents the imported method "get-flags".
//
// get-flags: func() -> result<descriptor-flags, error-code>
//
//go:nosplit
func (self Descriptor) GetFlags() (result cm.Result[DescriptorFlags, DescriptorFlags, ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
wasmimport_DescriptorGetFlags((uint32)(self0), &result)
return
}
// GetType represents the imported method "get-type".
//
// get-type: func() -> result<descriptor-type, error-code>
//
//go:nosplit
func (self Descriptor) GetType() (result cm.Result[DescriptorType, DescriptorType, ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
wasmimport_DescriptorGetType((uint32)(self0), &result)
return
}
// IsSameObject represents the imported method "is-same-object".
//
// is-same-object: func(other: borrow<descriptor>) -> bool
//
//go:nosplit
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))
return
}
// LinkAt represents the imported method "link-at".
//
// link-at: func(old-path-flags: path-flags, old-path: string, new-descriptor: borrow<descriptor>,
// new-path: string) -> result<_, error-code>
//
//go:nosplit
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)
newDescriptor0 := cm.Reinterpret[uint32](newDescriptor)
newPath0, newPath1 := cm.LowerString(newPath)
wasmimport_DescriptorLinkAt((uint32)(self0), (uint32)(oldPathFlags0), (*uint8)(oldPath0), (uint32)(oldPath1), (uint32)(newDescriptor0), (*uint8)(newPath0), (uint32)(newPath1), &result)
return
}
// MetadataHash represents the imported method "metadata-hash".
//
// metadata-hash: func() -> result<metadata-hash-value, error-code>
//
//go:nosplit
func (self Descriptor) MetadataHash() (result cm.Result[MetadataHashValueShape, MetadataHashValue, ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
wasmimport_DescriptorMetadataHash((uint32)(self0), &result)
return
}
// MetadataHashAt represents the imported method "metadata-hash-at".
//
// metadata-hash-at: func(path-flags: path-flags, path: string) -> result<metadata-hash-value,
// error-code>
//
//go:nosplit
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)
wasmimport_DescriptorMetadataHashAt((uint32)(self0), (uint32)(pathFlags0), (*uint8)(path0), (uint32)(path1), &result)
return
}
// OpenAt represents the imported method "open-at".
//
// open-at: func(path-flags: path-flags, path: string, open-flags: open-flags, %flags:
// descriptor-flags) -> result<descriptor, error-code>
//
//go:nosplit
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)
openFlags0 := (uint32)(openFlags)
flags0 := (uint32)(flags)
wasmimport_DescriptorOpenAt((uint32)(self0), (uint32)(pathFlags0), (*uint8)(path0), (uint32)(path1), (uint32)(openFlags0), (uint32)(flags0), &result)
return
}
// Read represents the imported method "read".
//
// read: func(length: filesize, offset: filesize) -> result<tuple<list<u8>, bool>,
// error-code>
//
//go:nosplit
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)
wasmimport_DescriptorRead((uint32)(self0), (uint64)(length0), (uint64)(offset0), &result)
return
}
// ReadDirectory represents the imported method "read-directory".
//
// read-directory: func() -> result<directory-entry-stream, error-code>
//
//go:nosplit
func (self Descriptor) ReadDirectory() (result cm.Result[DirectoryEntryStream, DirectoryEntryStream, ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
wasmimport_DescriptorReadDirectory((uint32)(self0), &result)
return
}
// ReadViaStream represents the imported method "read-via-stream".
//
// read-via-stream: func(offset: filesize) -> result<input-stream, error-code>
//
//go:nosplit
func (self Descriptor) ReadViaStream(offset FileSize) (result cm.Result[InputStream, InputStream, ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
offset0 := (uint64)(offset)
wasmimport_DescriptorReadViaStream((uint32)(self0), (uint64)(offset0), &result)
return
}
// ReadLinkAt represents the imported method "readlink-at".
//
// readlink-at: func(path: string) -> result<string, error-code>
//
//go:nosplit
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)
return
}
// RemoveDirectoryAt represents the imported method "remove-directory-at".
//
// remove-directory-at: func(path: string) -> result<_, error-code>
//
//go:nosplit
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)
return
}
// RenameAt represents the imported method "rename-at".
//
// rename-at: func(old-path: string, new-descriptor: borrow<descriptor>, new-path:
// string) -> result<_, error-code>
//
//go:nosplit
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)
newPath0, newPath1 := cm.LowerString(newPath)
wasmimport_DescriptorRenameAt((uint32)(self0), (*uint8)(oldPath0), (uint32)(oldPath1), (uint32)(newDescriptor0), (*uint8)(newPath0), (uint32)(newPath1), &result)
return
}
// SetSize represents the imported method "set-size".
//
// set-size: func(size: filesize) -> result<_, error-code>
//
//go:nosplit
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)
return
}
// SetTimes represents the imported method "set-times".
//
// set-times: func(data-access-timestamp: new-timestamp, data-modification-timestamp:
// new-timestamp) -> result<_, error-code>
//
//go:nosplit
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)
wasmimport_DescriptorSetTimes((uint32)(self0), (uint32)(dataAccessTimestamp0), (uint64)(dataAccessTimestamp1), (uint32)(dataAccessTimestamp2), (uint32)(dataModificationTimestamp0), (uint64)(dataModificationTimestamp1), (uint32)(dataModificationTimestamp2), &result)
return
}
// SetTimesAt represents the imported method "set-times-at".
//
// set-times-at: func(path-flags: path-flags, path: string, data-access-timestamp:
// 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.Result[ErrorCode, struct{}, ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
pathFlags0 := (uint32)(pathFlags)
path0, path1 := cm.LowerString(path)
dataAccessTimestamp0, dataAccessTimestamp1, dataAccessTimestamp2 := lower_NewTimestamp(dataAccessTimestamp)
dataModificationTimestamp0, dataModificationTimestamp1, dataModificationTimestamp2 := lower_NewTimestamp(dataModificationTimestamp)
wasmimport_DescriptorSetTimesAt((uint32)(self0), (uint32)(pathFlags0), (*uint8)(path0), (uint32)(path1), (uint32)(dataAccessTimestamp0), (uint64)(dataAccessTimestamp1), (uint32)(dataAccessTimestamp2), (uint32)(dataModificationTimestamp0), (uint64)(dataModificationTimestamp1), (uint32)(dataModificationTimestamp2), &result)
return
}
// Stat represents the imported method "stat".
//
// stat: func() -> result<descriptor-stat, error-code>
//
//go:nosplit
func (self Descriptor) Stat() (result cm.Result[DescriptorStatShape, DescriptorStat, ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
wasmimport_DescriptorStat((uint32)(self0), &result)
return
}
// StatAt represents the imported method "stat-at".
//
// stat-at: func(path-flags: path-flags, path: string) -> result<descriptor-stat,
// error-code>
//
//go:nosplit
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)
wasmimport_DescriptorStatAt((uint32)(self0), (uint32)(pathFlags0), (*uint8)(path0), (uint32)(path1), &result)
return
}
// SymlinkAt represents the imported method "symlink-at".
//
// symlink-at: func(old-path: string, new-path: string) -> result<_, error-code>
//
//go:nosplit
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)
wasmimport_DescriptorSymlinkAt((uint32)(self0), (*uint8)(oldPath0), (uint32)(oldPath1), (*uint8)(newPath0), (uint32)(newPath1), &result)
return
}
// Sync represents the imported method "sync".
//
// sync: func() -> result<_, error-code>
//
//go:nosplit
func (self Descriptor) Sync() (result cm.Result[ErrorCode, struct{}, ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
wasmimport_DescriptorSync((uint32)(self0), &result)
return
}
// SyncData represents the imported method "sync-data".
//
// sync-data: func() -> result<_, error-code>
//
//go:nosplit
func (self Descriptor) SyncData() (result cm.Result[ErrorCode, struct{}, ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
wasmimport_DescriptorSyncData((uint32)(self0), &result)
return
}
// UnlinkFileAt represents the imported method "unlink-file-at".
//
// unlink-file-at: func(path: string) -> result<_, error-code>
//
//go:nosplit
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)
return
}
// Write represents the imported method "write".
//
// 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.Result[uint64, FileSize, ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
buffer0, buffer1 := cm.LowerList(buffer)
offset0 := (uint64)(offset)
wasmimport_DescriptorWrite((uint32)(self0), (*uint8)(buffer0), (uint32)(buffer1), (uint64)(offset0), &result)
return
}
// WriteViaStream represents the imported method "write-via-stream".
//
// write-via-stream: func(offset: filesize) -> result<output-stream, error-code>
//
//go:nosplit
func (self Descriptor) WriteViaStream(offset FileSize) (result cm.Result[OutputStream, OutputStream, ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
offset0 := (uint64)(offset)
wasmimport_DescriptorWriteViaStream((uint32)(self0), (uint64)(offset0), &result)
return
}
// DirectoryEntryStream represents the imported resource "wasi:filesystem/types@0.2.0#directory-entry-stream".
//
// resource directory-entry-stream
type DirectoryEntryStream cm.Resource
// ResourceDrop represents the imported resource-drop for resource "directory-entry-stream".
//
// Drops a resource handle.
//
//go:nosplit
func (self DirectoryEntryStream) ResourceDrop() {
self0 := cm.Reinterpret[uint32](self)
wasmimport_DirectoryEntryStreamResourceDrop((uint32)(self0))
return
}
// ReadDirectoryEntry represents the imported method "read-directory-entry".
//
// read-directory-entry: func() -> result<option<directory-entry>, error-code>
//
//go:nosplit
func (self DirectoryEntryStream) ReadDirectoryEntry() (result cm.Result[OptionDirectoryEntryShape, cm.Option[DirectoryEntry], ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
wasmimport_DirectoryEntryStreamReadDirectoryEntry((uint32)(self0), &result)
return
}
// FilesystemErrorCode represents the imported function "filesystem-error-code".
//
// filesystem-error-code: func(err: borrow<error>) -> option<error-code>
//
//go:nosplit
func FilesystemErrorCode(err Error) (result cm.Option[ErrorCode]) {
err0 := cm.Reinterpret[uint32](err)
wasmimport_FilesystemErrorCode((uint32)(err0), &result)
return
}

View File

@ -0,0 +1,25 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
package outgoinghandler
import (
"gitea.rebus.ninja/lore/go-nats-client/gen/wasi/http/types"
"github.com/bytecodealliance/wasm-tools-go/cm"
"unsafe"
)
// ErrorCodeShape is used for storage in variant or result types.
type ErrorCodeShape struct {
_ cm.HostLayout
shape [unsafe.Sizeof(types.ErrorCode{})]byte
}
func lower_OptionRequestOptions(v cm.Option[RequestOptions]) (f0 uint32, f1 uint32) {
some := v.Some()
if some != nil {
f0 = 1
v1 := cm.Reinterpret[uint32](*some)
f1 = (uint32)(v1)
}
return
}

View File

@ -0,0 +1,3 @@
// This file exists for testing this package without WebAssembly,
// allowing empty function bodies with a //go:wasmimport directive.
// See https://pkg.go.dev/cmd/compile for more information.

View File

@ -0,0 +1,42 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
// Package outgoinghandler represents the imported interface "wasi:http/outgoing-handler@0.2.0".
package outgoinghandler
import (
"gitea.rebus.ninja/lore/go-nats-client/gen/wasi/http/types"
"github.com/bytecodealliance/wasm-tools-go/cm"
)
// OutgoingRequest represents the imported type alias "wasi:http/outgoing-handler@0.2.0#outgoing-request".
//
// See [types.OutgoingRequest] for more information.
type OutgoingRequest = types.OutgoingRequest
// RequestOptions represents the imported type alias "wasi:http/outgoing-handler@0.2.0#request-options".
//
// See [types.RequestOptions] for more information.
type RequestOptions = types.RequestOptions
// FutureIncomingResponse represents the imported type alias "wasi:http/outgoing-handler@0.2.0#future-incoming-response".
//
// See [types.FutureIncomingResponse] for more information.
type FutureIncomingResponse = types.FutureIncomingResponse
// ErrorCode represents the type alias "wasi:http/outgoing-handler@0.2.0#error-code".
//
// See [types.ErrorCode] for more information.
type ErrorCode = types.ErrorCode
// Handle represents the imported function "handle".
//
// handle: func(request: outgoing-request, options: option<request-options>) -> result<future-incoming-response,
// error-code>
//
//go:nosplit
func Handle(request OutgoingRequest, options cm.Option[RequestOptions]) (result cm.Result[ErrorCodeShape, FutureIncomingResponse, ErrorCode]) {
request0 := cm.Reinterpret[uint32](request)
options0, options1 := lower_OptionRequestOptions(options)
wasmimport_Handle((uint32)(request0), (uint32)(options0), (uint32)(options1), &result)
return
}

View File

@ -0,0 +1,13 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
package outgoinghandler
import (
"github.com/bytecodealliance/wasm-tools-go/cm"
)
// This file contains wasmimport and wasmexport declarations for "wasi:http@0.2.0".
//go:wasmimport wasi:http/outgoing-handler@0.2.0 handle
//go:noescape
func wasmimport_Handle(request0 uint32, options0 uint32, options1 uint32, result *cm.Result[ErrorCodeShape, FutureIncomingResponse, ErrorCode])

264
gen/wasi/http/types/abi.go Normal file
View File

@ -0,0 +1,264 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
package types
import (
"github.com/bytecodealliance/wasm-tools-go/cm"
"unsafe"
)
// OptionFieldSizePayloadShape is used for storage in variant or result types.
type OptionFieldSizePayloadShape struct {
_ cm.HostLayout
shape [unsafe.Sizeof(cm.Option[FieldSizePayload]{})]byte
}
func lower_OptionString(v cm.Option[string]) (f0 uint32, f1 *uint8, f2 uint32) {
some := v.Some()
if some != nil {
f0 = 1
v1, v2 := cm.LowerString(*some)
f1 = (*uint8)(v1)
f2 = (uint32)(v2)
}
return
}
func lower_Method(v Method) (f0 uint32, f1 *uint8, f2 uint32) {
f0 = (uint32)(v.Tag())
switch f0 {
case 9: // other
v1, v2 := cm.LowerString(*v.Other())
f1 = (*uint8)(v1)
f2 = (uint32)(v2)
}
return
}
func lower_Scheme(v Scheme) (f0 uint32, f1 *uint8, f2 uint32) {
f0 = (uint32)(v.Tag())
switch f0 {
case 2: // other
v1, v2 := cm.LowerString(*v.Other())
f1 = (*uint8)(v1)
f2 = (uint32)(v2)
}
return
}
func lower_OptionScheme(v cm.Option[Scheme]) (f0 uint32, f1 uint32, f2 *uint8, f3 uint32) {
some := v.Some()
if some != nil {
f0 = 1
v1, v2, v3 := lower_Scheme(*some)
f1 = (uint32)(v1)
f2 = (*uint8)(v2)
f3 = (uint32)(v3)
}
return
}
func lower_OptionDuration(v cm.Option[Duration]) (f0 uint32, f1 uint64) {
some := v.Some()
if some != nil {
f0 = 1
v1 := (uint64)(*some)
f1 = (uint64)(v1)
}
return
}
// ErrorCodeShape is used for storage in variant or result types.
type ErrorCodeShape struct {
_ cm.HostLayout
shape [unsafe.Sizeof(ErrorCode{})]byte
}
func lower_OptionU16(v cm.Option[uint16]) (f0 uint32, f1 uint32) {
some := v.Some()
if some != nil {
f0 = 1
v1 := (uint32)(*some)
f1 = (uint32)(v1)
}
return
}
func lower_DNSErrorPayload(v DNSErrorPayload) (f0 uint32, f1 *uint8, f2 uint32, f3 uint32, f4 uint32) {
f0, f1, f2 = lower_OptionString(v.Rcode)
f3, f4 = lower_OptionU16(v.InfoCode)
return
}
func lower_OptionU8(v cm.Option[uint8]) (f0 uint32, f1 uint32) {
some := v.Some()
if some != nil {
f0 = 1
v1 := (uint32)(*some)
f1 = (uint32)(v1)
}
return
}
func lower_TLSAlertReceivedPayload(v TLSAlertReceivedPayload) (f0 uint32, f1 uint32, f2 uint32, f3 *uint8, f4 uint32) {
f0, f1 = lower_OptionU8(v.AlertID)
f2, f3, f4 = lower_OptionString(v.AlertMessage)
return
}
func lower_OptionU64(v cm.Option[uint64]) (f0 uint32, f1 uint64) {
some := v.Some()
if some != nil {
f0 = 1
v1 := (uint64)(*some)
f1 = (uint64)(v1)
}
return
}
func lower_OptionU32(v cm.Option[uint32]) (f0 uint32, f1 uint32) {
some := v.Some()
if some != nil {
f0 = 1
v1 := (uint32)(*some)
f1 = (uint32)(v1)
}
return
}
func lower_FieldSizePayload(v FieldSizePayload) (f0 uint32, f1 *uint8, f2 uint32, f3 uint32, f4 uint32) {
f0, f1, f2 = lower_OptionString(v.FieldName)
f3, f4 = lower_OptionU32(v.FieldSize)
return
}
func lower_OptionFieldSizePayload(v cm.Option[FieldSizePayload]) (f0 uint32, f1 uint32, f2 *uint8, f3 uint32, f4 uint32, f5 uint32) {
some := v.Some()
if some != nil {
f0 = 1
v1, v2, v3, v4, v5 := lower_FieldSizePayload(*some)
f1 = (uint32)(v1)
f2 = (*uint8)(v2)
f3 = (uint32)(v3)
f4 = (uint32)(v4)
f5 = (uint32)(v5)
}
return
}
func lower_ErrorCode(v ErrorCode) (f0 uint32, f1 uint32, f2 uint64, f3 uint32, f4 uint32, f5 uint32, f6 uint32) {
f0 = (uint32)(v.Tag())
switch f0 {
case 1: // DNS-error
v1, v2, v3, v4, v5 := lower_DNSErrorPayload(*v.DNSError())
f1 = (uint32)(v1)
f2 = cm.PointerToU64(v2)
f3 = (uint32)(v3)
f4 = (uint32)(v4)
f5 = (uint32)(v5)
case 14: // TLS-alert-received
v1, v2, v3, v4, v5 := lower_TLSAlertReceivedPayload(*v.TLSAlertReceived())
f1 = (uint32)(v1)
f2 = (uint64)(v2)
f3 = (uint32)(v3)
f4 = cm.PointerToU32(v4)
f5 = (uint32)(v5)
case 17: // HTTP-request-body-size
v1, v2 := lower_OptionU64(*v.HTTPRequestBodySize())
f1 = (uint32)(v1)
f2 = (uint64)(v2)
case 21: // HTTP-request-header-section-size
v1, v2 := lower_OptionU32(*v.HTTPRequestHeaderSectionSize())
f1 = (uint32)(v1)
f2 = (uint64)(v2)
case 22: // HTTP-request-header-size
v1, v2, v3, v4, v5, v6 := lower_OptionFieldSizePayload(*v.HTTPRequestHeaderSize())
f1 = (uint32)(v1)
f2 = (uint64)(v2)
f3 = cm.PointerToU32(v3)
f4 = (uint32)(v4)
f5 = (uint32)(v5)
f6 = (uint32)(v6)
case 23: // HTTP-request-trailer-section-size
v1, v2 := lower_OptionU32(*v.HTTPRequestTrailerSectionSize())
f1 = (uint32)(v1)
f2 = (uint64)(v2)
case 24: // HTTP-request-trailer-size
v1, v2, v3, v4, v5 := lower_FieldSizePayload(*v.HTTPRequestTrailerSize())
f1 = (uint32)(v1)
f2 = cm.PointerToU64(v2)
f3 = (uint32)(v3)
f4 = (uint32)(v4)
f5 = (uint32)(v5)
case 26: // HTTP-response-header-section-size
v1, v2 := lower_OptionU32(*v.HTTPResponseHeaderSectionSize())
f1 = (uint32)(v1)
f2 = (uint64)(v2)
case 27: // HTTP-response-header-size
v1, v2, v3, v4, v5 := lower_FieldSizePayload(*v.HTTPResponseHeaderSize())
f1 = (uint32)(v1)
f2 = cm.PointerToU64(v2)
f3 = (uint32)(v3)
f4 = (uint32)(v4)
f5 = (uint32)(v5)
case 28: // HTTP-response-body-size
v1, v2 := lower_OptionU64(*v.HTTPResponseBodySize())
f1 = (uint32)(v1)
f2 = (uint64)(v2)
case 29: // HTTP-response-trailer-section-size
v1, v2 := lower_OptionU32(*v.HTTPResponseTrailerSectionSize())
f1 = (uint32)(v1)
f2 = (uint64)(v2)
case 30: // HTTP-response-trailer-size
v1, v2, v3, v4, v5 := lower_FieldSizePayload(*v.HTTPResponseTrailerSize())
f1 = (uint32)(v1)
f2 = cm.PointerToU64(v2)
f3 = (uint32)(v3)
f4 = (uint32)(v4)
f5 = (uint32)(v5)
case 31: // HTTP-response-transfer-coding
v1, v2, v3 := lower_OptionString(*v.HTTPResponseTransferCoding())
f1 = (uint32)(v1)
f2 = cm.PointerToU64(v2)
f3 = (uint32)(v3)
case 32: // HTTP-response-content-coding
v1, v2, v3 := lower_OptionString(*v.HTTPResponseContentCoding())
f1 = (uint32)(v1)
f2 = cm.PointerToU64(v2)
f3 = (uint32)(v3)
case 38: // internal-error
v1, v2, v3 := lower_OptionString(*v.InternalError())
f1 = (uint32)(v1)
f2 = cm.PointerToU64(v2)
f3 = (uint32)(v3)
}
return
}
func lower_ResultOutgoingResponseErrorCode(v cm.Result[ErrorCodeShape, OutgoingResponse, ErrorCode]) (f0 uint32, f1 uint32, f2 uint32, f3 uint64, f4 uint32, f5 uint32, f6 uint32, f7 uint32) {
if v.IsOK() {
v1 := cm.Reinterpret[uint32](*v.OK())
f1 = (uint32)(v1)
} else {
f0 = 1
v1, v2, v3, v4, v5, v6, v7 := lower_ErrorCode(*v.Err())
f1 = (uint32)(v1)
f2 = (uint32)(v2)
f3 = (uint64)(v3)
f4 = (uint32)(v4)
f5 = (uint32)(v5)
f6 = (uint32)(v6)
f7 = (uint32)(v7)
}
return
}
func lower_OptionTrailers(v cm.Option[Trailers]) (f0 uint32, f1 uint32) {
some := v.Some()
if some != nil {
f0 = 1
v1 := cm.Reinterpret[uint32](*some)
f1 = (uint32)(v1)
}
return
}

View File

@ -0,0 +1,3 @@
// This file exists for testing this package without WebAssembly,
// allowing empty function bodies with a //go:wasmimport directive.
// See https://pkg.go.dev/cmd/compile for more information.

View File

@ -0,0 +1,257 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
package types
import (
"github.com/bytecodealliance/wasm-tools-go/cm"
)
// This file contains wasmimport and wasmexport declarations for "wasi:http@0.2.0".
//go:wasmimport wasi:http/types@0.2.0 [resource-drop]fields
//go:noescape
func wasmimport_FieldsResourceDrop(self0 uint32)
//go:wasmimport wasi:http/types@0.2.0 [constructor]fields
//go:noescape
func wasmimport_NewFields() (result0 uint32)
//go:wasmimport wasi:http/types@0.2.0 [static]fields.from-list
//go:noescape
func wasmimport_FieldsFromList(entries0 *cm.Tuple[FieldKey, FieldValue], entries1 uint32, result *cm.Result[Fields, Fields, HeaderError])
//go:wasmimport wasi:http/types@0.2.0 [method]fields.append
//go:noescape
func wasmimport_FieldsAppend(self0 uint32, name0 *uint8, name1 uint32, value0 *uint8, value1 uint32, result *cm.Result[HeaderError, struct{}, HeaderError])
//go:wasmimport wasi:http/types@0.2.0 [method]fields.clone
//go:noescape
func wasmimport_FieldsClone(self0 uint32) (result0 uint32)
//go:wasmimport wasi:http/types@0.2.0 [method]fields.delete
//go:noescape
func wasmimport_FieldsDelete(self0 uint32, name0 *uint8, name1 uint32, result *cm.Result[HeaderError, struct{}, HeaderError])
//go:wasmimport wasi:http/types@0.2.0 [method]fields.entries
//go:noescape
func wasmimport_FieldsEntries(self0 uint32, result *cm.List[cm.Tuple[FieldKey, FieldValue]])
//go:wasmimport wasi:http/types@0.2.0 [method]fields.get
//go:noescape
func wasmimport_FieldsGet(self0 uint32, name0 *uint8, name1 uint32, result *cm.List[FieldValue])
//go:wasmimport wasi:http/types@0.2.0 [method]fields.has
//go:noescape
func wasmimport_FieldsHas(self0 uint32, name0 *uint8, name1 uint32) (result0 uint32)
//go:wasmimport wasi:http/types@0.2.0 [method]fields.set
//go:noescape
func wasmimport_FieldsSet(self0 uint32, name0 *uint8, name1 uint32, value0 *FieldValue, value1 uint32, result *cm.Result[HeaderError, struct{}, HeaderError])
//go:wasmimport wasi:http/types@0.2.0 [resource-drop]incoming-request
//go:noescape
func wasmimport_IncomingRequestResourceDrop(self0 uint32)
//go:wasmimport wasi:http/types@0.2.0 [method]incoming-request.authority
//go:noescape
func wasmimport_IncomingRequestAuthority(self0 uint32, result *cm.Option[string])
//go:wasmimport wasi:http/types@0.2.0 [method]incoming-request.consume
//go:noescape
func wasmimport_IncomingRequestConsume(self0 uint32, result *cm.Result[IncomingBody, IncomingBody, struct{}])
//go:wasmimport wasi:http/types@0.2.0 [method]incoming-request.headers
//go:noescape
func wasmimport_IncomingRequestHeaders(self0 uint32) (result0 uint32)
//go:wasmimport wasi:http/types@0.2.0 [method]incoming-request.method
//go:noescape
func wasmimport_IncomingRequestMethod(self0 uint32, result *Method)
//go:wasmimport wasi:http/types@0.2.0 [method]incoming-request.path-with-query
//go:noescape
func wasmimport_IncomingRequestPathWithQuery(self0 uint32, result *cm.Option[string])
//go:wasmimport wasi:http/types@0.2.0 [method]incoming-request.scheme
//go:noescape
func wasmimport_IncomingRequestScheme(self0 uint32, result *cm.Option[Scheme])
//go:wasmimport wasi:http/types@0.2.0 [resource-drop]outgoing-request
//go:noescape
func wasmimport_OutgoingRequestResourceDrop(self0 uint32)
//go:wasmimport wasi:http/types@0.2.0 [constructor]outgoing-request
//go:noescape
func wasmimport_NewOutgoingRequest(headers0 uint32) (result0 uint32)
//go:wasmimport wasi:http/types@0.2.0 [method]outgoing-request.authority
//go:noescape
func wasmimport_OutgoingRequestAuthority(self0 uint32, result *cm.Option[string])
//go:wasmimport wasi:http/types@0.2.0 [method]outgoing-request.body
//go:noescape
func wasmimport_OutgoingRequestBody(self0 uint32, result *cm.Result[OutgoingBody, OutgoingBody, struct{}])
//go:wasmimport wasi:http/types@0.2.0 [method]outgoing-request.headers
//go:noescape
func wasmimport_OutgoingRequestHeaders(self0 uint32) (result0 uint32)
//go:wasmimport wasi:http/types@0.2.0 [method]outgoing-request.method
//go:noescape
func wasmimport_OutgoingRequestMethod(self0 uint32, result *Method)
//go:wasmimport wasi:http/types@0.2.0 [method]outgoing-request.path-with-query
//go:noescape
func wasmimport_OutgoingRequestPathWithQuery(self0 uint32, result *cm.Option[string])
//go:wasmimport wasi:http/types@0.2.0 [method]outgoing-request.scheme
//go:noescape
func wasmimport_OutgoingRequestScheme(self0 uint32, result *cm.Option[Scheme])
//go:wasmimport wasi:http/types@0.2.0 [method]outgoing-request.set-authority
//go:noescape
func wasmimport_OutgoingRequestSetAuthority(self0 uint32, authority0 uint32, authority1 *uint8, authority2 uint32) (result0 uint32)
//go:wasmimport wasi:http/types@0.2.0 [method]outgoing-request.set-method
//go:noescape
func wasmimport_OutgoingRequestSetMethod(self0 uint32, method0 uint32, method1 *uint8, method2 uint32) (result0 uint32)
//go:wasmimport wasi:http/types@0.2.0 [method]outgoing-request.set-path-with-query
//go:noescape
func wasmimport_OutgoingRequestSetPathWithQuery(self0 uint32, pathWithQuery0 uint32, pathWithQuery1 *uint8, pathWithQuery2 uint32) (result0 uint32)
//go:wasmimport wasi:http/types@0.2.0 [method]outgoing-request.set-scheme
//go:noescape
func wasmimport_OutgoingRequestSetScheme(self0 uint32, scheme0 uint32, scheme1 uint32, scheme2 *uint8, scheme3 uint32) (result0 uint32)
//go:wasmimport wasi:http/types@0.2.0 [resource-drop]request-options
//go:noescape
func wasmimport_RequestOptionsResourceDrop(self0 uint32)
//go:wasmimport wasi:http/types@0.2.0 [constructor]request-options
//go:noescape
func wasmimport_NewRequestOptions() (result0 uint32)
//go:wasmimport wasi:http/types@0.2.0 [method]request-options.between-bytes-timeout
//go:noescape
func wasmimport_RequestOptionsBetweenBytesTimeout(self0 uint32, result *cm.Option[Duration])
//go:wasmimport wasi:http/types@0.2.0 [method]request-options.connect-timeout
//go:noescape
func wasmimport_RequestOptionsConnectTimeout(self0 uint32, result *cm.Option[Duration])
//go:wasmimport wasi:http/types@0.2.0 [method]request-options.first-byte-timeout
//go:noescape
func wasmimport_RequestOptionsFirstByteTimeout(self0 uint32, result *cm.Option[Duration])
//go:wasmimport wasi:http/types@0.2.0 [method]request-options.set-between-bytes-timeout
//go:noescape
func wasmimport_RequestOptionsSetBetweenBytesTimeout(self0 uint32, duration0 uint32, duration1 uint64) (result0 uint32)
//go:wasmimport wasi:http/types@0.2.0 [method]request-options.set-connect-timeout
//go:noescape
func wasmimport_RequestOptionsSetConnectTimeout(self0 uint32, duration0 uint32, duration1 uint64) (result0 uint32)
//go:wasmimport wasi:http/types@0.2.0 [method]request-options.set-first-byte-timeout
//go:noescape
func wasmimport_RequestOptionsSetFirstByteTimeout(self0 uint32, duration0 uint32, duration1 uint64) (result0 uint32)
//go:wasmimport wasi:http/types@0.2.0 [resource-drop]response-outparam
//go:noescape
func wasmimport_ResponseOutparamResourceDrop(self0 uint32)
//go:wasmimport wasi:http/types@0.2.0 [static]response-outparam.set
//go:noescape
func wasmimport_ResponseOutparamSet(param0 uint32, response0 uint32, response1 uint32, response2 uint32, response3 uint64, response4 uint32, response5 uint32, response6 uint32, response7 uint32)
//go:wasmimport wasi:http/types@0.2.0 [resource-drop]incoming-response
//go:noescape
func wasmimport_IncomingResponseResourceDrop(self0 uint32)
//go:wasmimport wasi:http/types@0.2.0 [method]incoming-response.consume
//go:noescape
func wasmimport_IncomingResponseConsume(self0 uint32, result *cm.Result[IncomingBody, IncomingBody, struct{}])
//go:wasmimport wasi:http/types@0.2.0 [method]incoming-response.headers
//go:noescape
func wasmimport_IncomingResponseHeaders(self0 uint32) (result0 uint32)
//go:wasmimport wasi:http/types@0.2.0 [method]incoming-response.status
//go:noescape
func wasmimport_IncomingResponseStatus(self0 uint32) (result0 uint32)
//go:wasmimport wasi:http/types@0.2.0 [resource-drop]incoming-body
//go:noescape
func wasmimport_IncomingBodyResourceDrop(self0 uint32)
//go:wasmimport wasi:http/types@0.2.0 [static]incoming-body.finish
//go:noescape
func wasmimport_IncomingBodyFinish(this0 uint32) (result0 uint32)
//go:wasmimport wasi:http/types@0.2.0 [method]incoming-body.stream
//go:noescape
func wasmimport_IncomingBodyStream(self0 uint32, result *cm.Result[InputStream, InputStream, struct{}])
//go:wasmimport wasi:http/types@0.2.0 [resource-drop]future-trailers
//go:noescape
func wasmimport_FutureTrailersResourceDrop(self0 uint32)
//go:wasmimport wasi:http/types@0.2.0 [method]future-trailers.get
//go:noescape
func wasmimport_FutureTrailersGet(self0 uint32, result *cm.Option[cm.Result[cm.Result[ErrorCodeShape, cm.Option[Trailers], ErrorCode], cm.Result[ErrorCodeShape, cm.Option[Trailers], ErrorCode], struct{}]])
//go:wasmimport wasi:http/types@0.2.0 [method]future-trailers.subscribe
//go:noescape
func wasmimport_FutureTrailersSubscribe(self0 uint32) (result0 uint32)
//go:wasmimport wasi:http/types@0.2.0 [resource-drop]outgoing-response
//go:noescape
func wasmimport_OutgoingResponseResourceDrop(self0 uint32)
//go:wasmimport wasi:http/types@0.2.0 [constructor]outgoing-response
//go:noescape
func wasmimport_NewOutgoingResponse(headers0 uint32) (result0 uint32)
//go:wasmimport wasi:http/types@0.2.0 [method]outgoing-response.body
//go:noescape
func wasmimport_OutgoingResponseBody(self0 uint32, result *cm.Result[OutgoingBody, OutgoingBody, struct{}])
//go:wasmimport wasi:http/types@0.2.0 [method]outgoing-response.headers
//go:noescape
func wasmimport_OutgoingResponseHeaders(self0 uint32) (result0 uint32)
//go:wasmimport wasi:http/types@0.2.0 [method]outgoing-response.set-status-code
//go:noescape
func wasmimport_OutgoingResponseSetStatusCode(self0 uint32, statusCode0 uint32) (result0 uint32)
//go:wasmimport wasi:http/types@0.2.0 [method]outgoing-response.status-code
//go:noescape
func wasmimport_OutgoingResponseStatusCode(self0 uint32) (result0 uint32)
//go:wasmimport wasi:http/types@0.2.0 [resource-drop]outgoing-body
//go:noescape
func wasmimport_OutgoingBodyResourceDrop(self0 uint32)
//go:wasmimport wasi:http/types@0.2.0 [static]outgoing-body.finish
//go:noescape
func wasmimport_OutgoingBodyFinish(this0 uint32, trailers0 uint32, trailers1 uint32, result *cm.Result[ErrorCode, struct{}, ErrorCode])
//go:wasmimport wasi:http/types@0.2.0 [method]outgoing-body.write
//go:noescape
func wasmimport_OutgoingBodyWrite(self0 uint32, result *cm.Result[OutputStream, OutputStream, struct{}])
//go:wasmimport wasi:http/types@0.2.0 [resource-drop]future-incoming-response
//go:noescape
func wasmimport_FutureIncomingResponseResourceDrop(self0 uint32)
//go:wasmimport wasi:http/types@0.2.0 [method]future-incoming-response.get
//go:noescape
func wasmimport_FutureIncomingResponseGet(self0 uint32, result *cm.Option[cm.Result[cm.Result[ErrorCodeShape, IncomingResponse, ErrorCode], cm.Result[ErrorCodeShape, IncomingResponse, ErrorCode], struct{}]])
//go:wasmimport wasi:http/types@0.2.0 [method]future-incoming-response.subscribe
//go:noescape
func wasmimport_FutureIncomingResponseSubscribe(self0 uint32) (result0 uint32)
//go:wasmimport wasi:http/types@0.2.0 http-error-code
//go:noescape
func wasmimport_HTTPErrorCode(err0 uint32, result *cm.Option[ErrorCode])

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,3 @@
// This file exists for testing this package without WebAssembly,
// allowing empty function bodies with a //go:wasmimport directive.
// See https://pkg.go.dev/cmd/compile for more information.

View File

@ -0,0 +1,35 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
// Package ioerror represents the imported interface "wasi:io/error@0.2.0".
package ioerror
import (
"github.com/bytecodealliance/wasm-tools-go/cm"
)
// Error represents the imported resource "wasi:io/error@0.2.0#error".
//
// resource error
type Error cm.Resource
// ResourceDrop represents the imported resource-drop for resource "error".
//
// Drops a resource handle.
//
//go:nosplit
func (self Error) ResourceDrop() {
self0 := cm.Reinterpret[uint32](self)
wasmimport_ErrorResourceDrop((uint32)(self0))
return
}
// ToDebugString represents the imported method "to-debug-string".
//
// to-debug-string: func() -> string
//
//go:nosplit
func (self Error) ToDebugString() (result string) {
self0 := cm.Reinterpret[uint32](self)
wasmimport_ErrorToDebugString((uint32)(self0), &result)
return
}

View File

@ -0,0 +1,13 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
package ioerror
// This file contains wasmimport and wasmexport declarations for "wasi:io@0.2.0".
//go:wasmimport wasi:io/error@0.2.0 [resource-drop]error
//go:noescape
func wasmimport_ErrorResourceDrop(self0 uint32)
//go:wasmimport wasi:io/error@0.2.0 [method]error.to-debug-string
//go:noescape
func wasmimport_ErrorToDebugString(self0 uint32, result *string)

3
gen/wasi/io/poll/empty.s Normal file
View File

@ -0,0 +1,3 @@
// This file exists for testing this package without WebAssembly,
// allowing empty function bodies with a //go:wasmimport directive.
// See https://pkg.go.dev/cmd/compile for more information.

View File

@ -0,0 +1,25 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
package poll
import (
"github.com/bytecodealliance/wasm-tools-go/cm"
)
// This file contains wasmimport and wasmexport declarations for "wasi:io@0.2.0".
//go:wasmimport wasi:io/poll@0.2.0 [resource-drop]pollable
//go:noescape
func wasmimport_PollableResourceDrop(self0 uint32)
//go:wasmimport wasi:io/poll@0.2.0 [method]pollable.block
//go:noescape
func wasmimport_PollableBlock(self0 uint32)
//go:wasmimport wasi:io/poll@0.2.0 [method]pollable.ready
//go:noescape
func wasmimport_PollableReady(self0 uint32) (result0 uint32)
//go:wasmimport wasi:io/poll@0.2.0 poll
//go:noescape
func wasmimport_Poll(in0 *Pollable, in1 uint32, result *cm.List[uint32])

View File

@ -0,0 +1,58 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
// Package poll represents the imported interface "wasi:io/poll@0.2.0".
package poll
import (
"github.com/bytecodealliance/wasm-tools-go/cm"
)
// Pollable represents the imported resource "wasi:io/poll@0.2.0#pollable".
//
// resource pollable
type Pollable cm.Resource
// ResourceDrop represents the imported resource-drop for resource "pollable".
//
// Drops a resource handle.
//
//go:nosplit
func (self Pollable) ResourceDrop() {
self0 := cm.Reinterpret[uint32](self)
wasmimport_PollableResourceDrop((uint32)(self0))
return
}
// Block represents the imported method "block".
//
// block: func()
//
//go:nosplit
func (self Pollable) Block() {
self0 := cm.Reinterpret[uint32](self)
wasmimport_PollableBlock((uint32)(self0))
return
}
// Ready represents the imported method "ready".
//
// ready: func() -> bool
//
//go:nosplit
func (self Pollable) Ready() (result bool) {
self0 := cm.Reinterpret[uint32](self)
result0 := wasmimport_PollableReady((uint32)(self0))
result = cm.U32ToBool((uint32)(result0))
return
}
// Poll represents the imported function "poll".
//
// poll: func(in: list<borrow<pollable>>) -> list<u32>
//
//go:nosplit
func Poll(in cm.List[Pollable]) (result cm.List[uint32]) {
in0, in1 := cm.LowerList(in)
wasmimport_Poll((*Pollable)(in0), (uint32)(in1), &result)
return
}

View File

@ -0,0 +1,3 @@
// This file exists for testing this package without WebAssembly,
// allowing empty function bodies with a //go:wasmimport directive.
// See https://pkg.go.dev/cmd/compile for more information.

View File

@ -0,0 +1,77 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
package streams
import (
"github.com/bytecodealliance/wasm-tools-go/cm"
)
// This file contains wasmimport and wasmexport declarations for "wasi:io@0.2.0".
//go:wasmimport wasi:io/streams@0.2.0 [resource-drop]input-stream
//go:noescape
func wasmimport_InputStreamResourceDrop(self0 uint32)
//go:wasmimport wasi:io/streams@0.2.0 [method]input-stream.blocking-read
//go:noescape
func wasmimport_InputStreamBlockingRead(self0 uint32, len0 uint64, result *cm.Result[cm.List[uint8], cm.List[uint8], StreamError])
//go:wasmimport wasi:io/streams@0.2.0 [method]input-stream.blocking-skip
//go:noescape
func wasmimport_InputStreamBlockingSkip(self0 uint32, len0 uint64, result *cm.Result[uint64, uint64, StreamError])
//go:wasmimport wasi:io/streams@0.2.0 [method]input-stream.read
//go:noescape
func wasmimport_InputStreamRead(self0 uint32, len0 uint64, result *cm.Result[cm.List[uint8], cm.List[uint8], StreamError])
//go:wasmimport wasi:io/streams@0.2.0 [method]input-stream.skip
//go:noescape
func wasmimport_InputStreamSkip(self0 uint32, len0 uint64, result *cm.Result[uint64, uint64, StreamError])
//go:wasmimport wasi:io/streams@0.2.0 [method]input-stream.subscribe
//go:noescape
func wasmimport_InputStreamSubscribe(self0 uint32) (result0 uint32)
//go:wasmimport wasi:io/streams@0.2.0 [resource-drop]output-stream
//go:noescape
func wasmimport_OutputStreamResourceDrop(self0 uint32)
//go:wasmimport wasi:io/streams@0.2.0 [method]output-stream.blocking-flush
//go:noescape
func wasmimport_OutputStreamBlockingFlush(self0 uint32, result *cm.Result[StreamError, struct{}, StreamError])
//go:wasmimport wasi:io/streams@0.2.0 [method]output-stream.blocking-splice
//go:noescape
func wasmimport_OutputStreamBlockingSplice(self0 uint32, src0 uint32, len0 uint64, result *cm.Result[uint64, uint64, StreamError])
//go:wasmimport wasi:io/streams@0.2.0 [method]output-stream.blocking-write-and-flush
//go:noescape
func wasmimport_OutputStreamBlockingWriteAndFlush(self0 uint32, contents0 *uint8, contents1 uint32, result *cm.Result[StreamError, struct{}, StreamError])
//go:wasmimport wasi:io/streams@0.2.0 [method]output-stream.blocking-write-zeroes-and-flush
//go:noescape
func wasmimport_OutputStreamBlockingWriteZeroesAndFlush(self0 uint32, len0 uint64, result *cm.Result[StreamError, struct{}, StreamError])
//go:wasmimport wasi:io/streams@0.2.0 [method]output-stream.check-write
//go:noescape
func wasmimport_OutputStreamCheckWrite(self0 uint32, result *cm.Result[uint64, uint64, StreamError])
//go:wasmimport wasi:io/streams@0.2.0 [method]output-stream.flush
//go:noescape
func wasmimport_OutputStreamFlush(self0 uint32, result *cm.Result[StreamError, struct{}, StreamError])
//go:wasmimport wasi:io/streams@0.2.0 [method]output-stream.splice
//go:noescape
func wasmimport_OutputStreamSplice(self0 uint32, src0 uint32, len0 uint64, result *cm.Result[uint64, uint64, StreamError])
//go:wasmimport wasi:io/streams@0.2.0 [method]output-stream.subscribe
//go:noescape
func wasmimport_OutputStreamSubscribe(self0 uint32) (result0 uint32)
//go:wasmimport wasi:io/streams@0.2.0 [method]output-stream.write
//go:noescape
func wasmimport_OutputStreamWrite(self0 uint32, contents0 *uint8, contents1 uint32, result *cm.Result[StreamError, struct{}, StreamError])
//go:wasmimport wasi:io/streams@0.2.0 [method]output-stream.write-zeroes
//go:noescape
func wasmimport_OutputStreamWriteZeroes(self0 uint32, len0 uint64, result *cm.Result[StreamError, struct{}, StreamError])

View File

@ -0,0 +1,270 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
// Package streams represents the imported interface "wasi:io/streams@0.2.0".
package streams
import (
ioerror "gitea.rebus.ninja/lore/go-nats-client/gen/wasi/io/error"
"gitea.rebus.ninja/lore/go-nats-client/gen/wasi/io/poll"
"github.com/bytecodealliance/wasm-tools-go/cm"
)
// Error represents the imported type alias "wasi:io/streams@0.2.0#error".
//
// See [ioerror.Error] for more information.
type Error = ioerror.Error
// Pollable represents the imported type alias "wasi:io/streams@0.2.0#pollable".
//
// See [poll.Pollable] for more information.
type Pollable = poll.Pollable
// StreamError represents the imported variant "wasi:io/streams@0.2.0#stream-error".
//
// variant stream-error {
// last-operation-failed(error),
// closed,
// }
type StreamError cm.Variant[uint8, Error, Error]
// StreamErrorLastOperationFailed returns a [StreamError] of case "last-operation-failed".
func StreamErrorLastOperationFailed(data Error) StreamError {
return cm.New[StreamError](0, data)
}
// LastOperationFailed returns a non-nil *[Error] if [StreamError] represents the variant case "last-operation-failed".
func (self *StreamError) LastOperationFailed() *Error {
return cm.Case[Error](self, 0)
}
// StreamErrorClosed returns a [StreamError] of case "closed".
func StreamErrorClosed() StreamError {
var data struct{}
return cm.New[StreamError](1, data)
}
// Closed returns true if [StreamError] represents the variant case "closed".
func (self *StreamError) Closed() bool {
return self.Tag() == 1
}
var stringsStreamError = [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()]
}
// InputStream represents the imported resource "wasi:io/streams@0.2.0#input-stream".
//
// resource input-stream
type InputStream cm.Resource
// ResourceDrop represents the imported resource-drop for resource "input-stream".
//
// Drops a resource handle.
//
//go:nosplit
func (self InputStream) ResourceDrop() {
self0 := cm.Reinterpret[uint32](self)
wasmimport_InputStreamResourceDrop((uint32)(self0))
return
}
// BlockingRead represents the imported method "blocking-read".
//
// blocking-read: func(len: u64) -> result<list<u8>, stream-error>
//
//go:nosplit
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)
return
}
// BlockingSkip represents the imported method "blocking-skip".
//
// blocking-skip: func(len: u64) -> result<u64, stream-error>
//
//go:nosplit
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)
return
}
// Read represents the imported method "read".
//
// read: func(len: u64) -> result<list<u8>, stream-error>
//
//go:nosplit
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)
return
}
// Skip represents the imported method "skip".
//
// skip: func(len: u64) -> result<u64, stream-error>
//
//go:nosplit
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)
return
}
// Subscribe represents the imported method "subscribe".
//
// subscribe: func() -> pollable
//
//go:nosplit
func (self InputStream) Subscribe() (result Pollable) {
self0 := cm.Reinterpret[uint32](self)
result0 := wasmimport_InputStreamSubscribe((uint32)(self0))
result = cm.Reinterpret[Pollable]((uint32)(result0))
return
}
// OutputStream represents the imported resource "wasi:io/streams@0.2.0#output-stream".
//
// resource output-stream
type OutputStream cm.Resource
// ResourceDrop represents the imported resource-drop for resource "output-stream".
//
// Drops a resource handle.
//
//go:nosplit
func (self OutputStream) ResourceDrop() {
self0 := cm.Reinterpret[uint32](self)
wasmimport_OutputStreamResourceDrop((uint32)(self0))
return
}
// BlockingFlush represents the imported method "blocking-flush".
//
// blocking-flush: func() -> result<_, stream-error>
//
//go:nosplit
func (self OutputStream) BlockingFlush() (result cm.Result[StreamError, struct{}, StreamError]) {
self0 := cm.Reinterpret[uint32](self)
wasmimport_OutputStreamBlockingFlush((uint32)(self0), &result)
return
}
// BlockingSplice represents the imported method "blocking-splice".
//
// 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.Result[uint64, uint64, StreamError]) {
self0 := cm.Reinterpret[uint32](self)
src0 := cm.Reinterpret[uint32](src)
len0 := (uint64)(len_)
wasmimport_OutputStreamBlockingSplice((uint32)(self0), (uint32)(src0), (uint64)(len0), &result)
return
}
// BlockingWriteAndFlush represents the imported method "blocking-write-and-flush".
//
// blocking-write-and-flush: func(contents: list<u8>) -> result<_, stream-error>
//
//go:nosplit
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)
return
}
// BlockingWriteZeroesAndFlush represents the imported method "blocking-write-zeroes-and-flush".
//
// blocking-write-zeroes-and-flush: func(len: u64) -> result<_, stream-error>
//
//go:nosplit
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)
return
}
// CheckWrite represents the imported method "check-write".
//
// check-write: func() -> result<u64, stream-error>
//
//go:nosplit
func (self OutputStream) CheckWrite() (result cm.Result[uint64, uint64, StreamError]) {
self0 := cm.Reinterpret[uint32](self)
wasmimport_OutputStreamCheckWrite((uint32)(self0), &result)
return
}
// Flush represents the imported method "flush".
//
// flush: func() -> result<_, stream-error>
//
//go:nosplit
func (self OutputStream) Flush() (result cm.Result[StreamError, struct{}, StreamError]) {
self0 := cm.Reinterpret[uint32](self)
wasmimport_OutputStreamFlush((uint32)(self0), &result)
return
}
// Splice represents the imported method "splice".
//
// splice: func(src: borrow<input-stream>, len: u64) -> result<u64, stream-error>
//
//go:nosplit
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_)
wasmimport_OutputStreamSplice((uint32)(self0), (uint32)(src0), (uint64)(len0), &result)
return
}
// Subscribe represents the imported method "subscribe".
//
// subscribe: func() -> pollable
//
//go:nosplit
func (self OutputStream) Subscribe() (result Pollable) {
self0 := cm.Reinterpret[uint32](self)
result0 := wasmimport_OutputStreamSubscribe((uint32)(self0))
result = cm.Reinterpret[Pollable]((uint32)(result0))
return
}
// Write represents the imported method "write".
//
// write: func(contents: list<u8>) -> result<_, stream-error>
//
//go:nosplit
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)
return
}
// WriteZeroes represents the imported method "write-zeroes".
//
// write-zeroes: func(len: u64) -> result<_, stream-error>
//
//go:nosplit
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)
return
}

View File

@ -0,0 +1,3 @@
// This file exists for testing this package without WebAssembly,
// allowing empty function bodies with a //go:wasmimport directive.
// See https://pkg.go.dev/cmd/compile for more information.

View File

@ -0,0 +1,9 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
package logging
// This file contains wasmimport and wasmexport declarations for "wasi:logging@0.1.0-draft".
//go:wasmimport wasi:logging/logging@0.1.0-draft log
//go:noescape
func wasmimport_Log(level0 uint32, context0 *uint8, context1 uint32, message0 *uint8, message1 uint32)

View File

@ -0,0 +1,82 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
// Package logging represents the imported interface "wasi:logging/logging@0.1.0-draft".
//
// WASI Logging is a logging API intended to let users emit log messages with
// simple priority levels and context values.
package logging
import (
"github.com/bytecodealliance/wasm-tools-go/cm"
)
// Level represents the enum "wasi:logging/logging@0.1.0-draft#level".
//
// A log level, describing a kind of message.
//
// enum level {
// trace,
// debug,
// info,
// warn,
// error,
// critical
// }
type Level uint8
const (
// Describes messages about the values of variables and the flow of
// control within a program.
LevelTrace Level = iota
// Describes messages likely to be of interest to someone debugging a
// program.
LevelDebug
// Describes messages likely to be of interest to someone monitoring a
// program.
LevelInfo
// Describes messages indicating hazardous situations.
LevelWarn
// Describes messages indicating serious errors.
LevelError
// Describes messages indicating fatal errors.
LevelCritical
)
var stringsLevel = [6]string{
"trace",
"debug",
"info",
"warn",
"error",
"critical",
}
// String implements [fmt.Stringer], returning the enum case name of e.
func (e Level) String() string {
return stringsLevel[e]
}
// Log represents the imported function "log".
//
// Emit a log message.
//
// A log message has a `level` describing what kind of message is being
// sent, a context, which is an uninterpreted string meant to help
// consumers group similar messages, and a string containing the message
// text.
//
// log: func(level: level, context: string, message: string)
//
//go:nosplit
func Log(level Level, context string, message string) {
level0 := (uint32)(level)
context0, context1 := cm.LowerString(context)
message0, message1 := cm.LowerString(message)
wasmimport_Log((uint32)(level0), (*uint8)(context0), (uint32)(context1), (*uint8)(message0), (uint32)(message1))
return
}

View File

@ -0,0 +1,3 @@
// This file exists for testing this package without WebAssembly,
// allowing empty function bodies with a //go:wasmimport directive.
// See https://pkg.go.dev/cmd/compile for more information.

View File

@ -0,0 +1,14 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
// Package insecureseed represents the imported interface "wasi:random/insecure-seed@0.2.0".
package insecureseed
// InsecureSeed represents the imported function "insecure-seed".
//
// insecure-seed: func() -> tuple<u64, u64>
//
//go:nosplit
func InsecureSeed() (result [2]uint64) {
wasmimport_InsecureSeed(&result)
return
}

View File

@ -0,0 +1,9 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
package insecureseed
// This file contains wasmimport and wasmexport declarations for "wasi:random@0.2.0".
//go:wasmimport wasi:random/insecure-seed@0.2.0 insecure-seed
//go:noescape
func wasmimport_InsecureSeed(result *[2]uint64)

View File

@ -0,0 +1,3 @@
// This file exists for testing this package without WebAssembly,
// allowing empty function bodies with a //go:wasmimport directive.
// See https://pkg.go.dev/cmd/compile for more information.

View File

@ -0,0 +1,17 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
package insecure
import (
"github.com/bytecodealliance/wasm-tools-go/cm"
)
// This file contains wasmimport and wasmexport declarations for "wasi:random@0.2.0".
//go:wasmimport wasi:random/insecure@0.2.0 get-insecure-random-bytes
//go:noescape
func wasmimport_GetInsecureRandomBytes(len0 uint64, result *cm.List[uint8])
//go:wasmimport wasi:random/insecure@0.2.0 get-insecure-random-u64
//go:noescape
func wasmimport_GetInsecureRandomU64() (result0 uint64)

View File

@ -0,0 +1,30 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
// Package insecure represents the imported interface "wasi:random/insecure@0.2.0".
package insecure
import (
"github.com/bytecodealliance/wasm-tools-go/cm"
)
// GetInsecureRandomBytes represents the imported function "get-insecure-random-bytes".
//
// get-insecure-random-bytes: func(len: u64) -> list<u8>
//
//go:nosplit
func GetInsecureRandomBytes(len_ uint64) (result cm.List[uint8]) {
len0 := (uint64)(len_)
wasmimport_GetInsecureRandomBytes((uint64)(len0), &result)
return
}
// GetInsecureRandomU64 represents the imported function "get-insecure-random-u64".
//
// get-insecure-random-u64: func() -> u64
//
//go:nosplit
func GetInsecureRandomU64() (result uint64) {
result0 := wasmimport_GetInsecureRandomU64()
result = (uint64)((uint64)(result0))
return
}

View File

@ -0,0 +1,3 @@
// This file exists for testing this package without WebAssembly,
// allowing empty function bodies with a //go:wasmimport directive.
// See https://pkg.go.dev/cmd/compile for more information.

View File

@ -0,0 +1,17 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
package random
import (
"github.com/bytecodealliance/wasm-tools-go/cm"
)
// This file contains wasmimport and wasmexport declarations for "wasi:random@0.2.0".
//go:wasmimport wasi:random/random@0.2.0 get-random-bytes
//go:noescape
func wasmimport_GetRandomBytes(len0 uint64, result *cm.List[uint8])
//go:wasmimport wasi:random/random@0.2.0 get-random-u64
//go:noescape
func wasmimport_GetRandomU64() (result0 uint64)

View File

@ -0,0 +1,30 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
// Package random represents the imported interface "wasi:random/random@0.2.0".
package random
import (
"github.com/bytecodealliance/wasm-tools-go/cm"
)
// GetRandomBytes represents the imported function "get-random-bytes".
//
// get-random-bytes: func(len: u64) -> list<u8>
//
//go:nosplit
func GetRandomBytes(len_ uint64) (result cm.List[uint8]) {
len0 := (uint64)(len_)
wasmimport_GetRandomBytes((uint64)(len0), &result)
return
}
// GetRandomU64 represents the imported function "get-random-u64".
//
// get-random-u64: func() -> u64
//
//go:nosplit
func GetRandomU64() (result uint64) {
result0 := wasmimport_GetRandomU64()
result = (uint64)((uint64)(result0))
return
}

View File

@ -0,0 +1,3 @@
// This file exists for testing this package without WebAssembly,
// allowing empty function bodies with a //go:wasmimport directive.
// See https://pkg.go.dev/cmd/compile for more information.

View File

@ -0,0 +1,25 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
// Package instancenetwork represents the imported interface "wasi:sockets/instance-network@0.2.0".
package instancenetwork
import (
"gitea.rebus.ninja/lore/go-nats-client/gen/wasi/sockets/network"
"github.com/bytecodealliance/wasm-tools-go/cm"
)
// Network represents the imported type alias "wasi:sockets/instance-network@0.2.0#network".
//
// See [network.Network] for more information.
type Network = network.Network
// InstanceNetwork represents the imported function "instance-network".
//
// instance-network: func() -> network
//
//go:nosplit
func InstanceNetwork() (result Network) {
result0 := wasmimport_InstanceNetwork()
result = cm.Reinterpret[Network]((uint32)(result0))
return
}

View File

@ -0,0 +1,9 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
package instancenetwork
// This file contains wasmimport and wasmexport declarations for "wasi:sockets@0.2.0".
//go:wasmimport wasi:sockets/instance-network@0.2.0 instance-network
//go:noescape
func wasmimport_InstanceNetwork() (result0 uint32)

View File

@ -0,0 +1,14 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
package ipnamelookup
import (
"github.com/bytecodealliance/wasm-tools-go/cm"
"unsafe"
)
// OptionIPAddressShape is used for storage in variant or result types.
type OptionIPAddressShape struct {
_ cm.HostLayout
shape [unsafe.Sizeof(cm.Option[IPAddress]{})]byte
}

View File

@ -0,0 +1,3 @@
// This file exists for testing this package without WebAssembly,
// allowing empty function bodies with a //go:wasmimport directive.
// See https://pkg.go.dev/cmd/compile for more information.

View File

@ -0,0 +1,82 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
// Package ipnamelookup represents the imported interface "wasi:sockets/ip-name-lookup@0.2.0".
package ipnamelookup
import (
"gitea.rebus.ninja/lore/go-nats-client/gen/wasi/io/poll"
"gitea.rebus.ninja/lore/go-nats-client/gen/wasi/sockets/network"
"github.com/bytecodealliance/wasm-tools-go/cm"
)
// Pollable represents the imported type alias "wasi:sockets/ip-name-lookup@0.2.0#pollable".
//
// See [poll.Pollable] for more information.
type Pollable = poll.Pollable
// Network represents the imported type alias "wasi:sockets/ip-name-lookup@0.2.0#network".
//
// See [network.Network] for more information.
type Network = network.Network
// ErrorCode represents the type alias "wasi:sockets/ip-name-lookup@0.2.0#error-code".
//
// See [network.ErrorCode] for more information.
type ErrorCode = network.ErrorCode
// IPAddress represents the type alias "wasi:sockets/ip-name-lookup@0.2.0#ip-address".
//
// See [network.IPAddress] for more information.
type IPAddress = network.IPAddress
// ResolveAddressStream represents the imported resource "wasi:sockets/ip-name-lookup@0.2.0#resolve-address-stream".
//
// resource resolve-address-stream
type ResolveAddressStream cm.Resource
// ResourceDrop represents the imported resource-drop for resource "resolve-address-stream".
//
// Drops a resource handle.
//
//go:nosplit
func (self ResolveAddressStream) ResourceDrop() {
self0 := cm.Reinterpret[uint32](self)
wasmimport_ResolveAddressStreamResourceDrop((uint32)(self0))
return
}
// ResolveNextAddress represents the imported method "resolve-next-address".
//
// resolve-next-address: func() -> result<option<ip-address>, error-code>
//
//go:nosplit
func (self ResolveAddressStream) ResolveNextAddress() (result cm.Result[OptionIPAddressShape, cm.Option[IPAddress], ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
wasmimport_ResolveAddressStreamResolveNextAddress((uint32)(self0), &result)
return
}
// Subscribe represents the imported method "subscribe".
//
// subscribe: func() -> pollable
//
//go:nosplit
func (self ResolveAddressStream) Subscribe() (result Pollable) {
self0 := cm.Reinterpret[uint32](self)
result0 := wasmimport_ResolveAddressStreamSubscribe((uint32)(self0))
result = cm.Reinterpret[Pollable]((uint32)(result0))
return
}
// ResolveAddresses represents the imported function "resolve-addresses".
//
// resolve-addresses: func(network: borrow<network>, name: string) -> result<resolve-address-stream,
// error-code>
//
//go:nosplit
func ResolveAddresses(network_ Network, name string) (result cm.Result[ResolveAddressStream, ResolveAddressStream, ErrorCode]) {
network0 := cm.Reinterpret[uint32](network_)
name0, name1 := cm.LowerString(name)
wasmimport_ResolveAddresses((uint32)(network0), (*uint8)(name0), (uint32)(name1), &result)
return
}

View File

@ -0,0 +1,25 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
package ipnamelookup
import (
"github.com/bytecodealliance/wasm-tools-go/cm"
)
// This file contains wasmimport and wasmexport declarations for "wasi:sockets@0.2.0".
//go:wasmimport wasi:sockets/ip-name-lookup@0.2.0 [resource-drop]resolve-address-stream
//go:noescape
func wasmimport_ResolveAddressStreamResourceDrop(self0 uint32)
//go:wasmimport wasi:sockets/ip-name-lookup@0.2.0 [method]resolve-address-stream.resolve-next-address
//go:noescape
func wasmimport_ResolveAddressStreamResolveNextAddress(self0 uint32, result *cm.Result[OptionIPAddressShape, cm.Option[IPAddress], ErrorCode])
//go:wasmimport wasi:sockets/ip-name-lookup@0.2.0 [method]resolve-address-stream.subscribe
//go:noescape
func wasmimport_ResolveAddressStreamSubscribe(self0 uint32) (result0 uint32)
//go:wasmimport wasi:sockets/ip-name-lookup@0.2.0 resolve-addresses
//go:noescape
func wasmimport_ResolveAddresses(network0 uint32, name0 *uint8, name1 uint32, result *cm.Result[ResolveAddressStream, ResolveAddressStream, ErrorCode])

View File

@ -0,0 +1,14 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
package network
import (
"github.com/bytecodealliance/wasm-tools-go/cm"
"unsafe"
)
// IPv6SocketAddressShape is used for storage in variant or result types.
type IPv6SocketAddressShape struct {
_ cm.HostLayout
shape [unsafe.Sizeof(IPv6SocketAddress{})]byte
}

View File

@ -0,0 +1,3 @@
// This file exists for testing this package without WebAssembly,
// allowing empty function bodies with a //go:wasmimport directive.
// See https://pkg.go.dev/cmd/compile for more information.

View File

@ -0,0 +1,9 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
package network
// This file contains wasmimport and wasmexport declarations for "wasi:sockets@0.2.0".
//go:wasmimport wasi:sockets/network@0.2.0 [resource-drop]network
//go:noescape
func wasmimport_NetworkResourceDrop(self0 uint32)

View File

@ -0,0 +1,241 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
// Package network represents the imported interface "wasi:sockets/network@0.2.0".
package network
import (
"github.com/bytecodealliance/wasm-tools-go/cm"
)
// Network represents the imported resource "wasi:sockets/network@0.2.0#network".
//
// resource network
type Network cm.Resource
// ResourceDrop represents the imported resource-drop for resource "network".
//
// Drops a resource handle.
//
//go:nosplit
func (self Network) ResourceDrop() {
self0 := cm.Reinterpret[uint32](self)
wasmimport_NetworkResourceDrop((uint32)(self0))
return
}
// ErrorCode represents the enum "wasi:sockets/network@0.2.0#error-code".
//
// enum error-code {
// 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
// }
type ErrorCode uint8
const (
ErrorCodeUnknown ErrorCode = iota
ErrorCodeAccessDenied
ErrorCodeNotSupported
ErrorCodeInvalidArgument
ErrorCodeOutOfMemory
ErrorCodeTimeout
ErrorCodeConcurrencyConflict
ErrorCodeNotInProgress
ErrorCodeWouldBlock
ErrorCodeInvalidState
ErrorCodeNewSocketLimit
ErrorCodeAddressNotBindable
ErrorCodeAddressInUse
ErrorCodeRemoteUnreachable
ErrorCodeConnectionRefused
ErrorCodeConnectionReset
ErrorCodeConnectionAborted
ErrorCodeDatagramTooLarge
ErrorCodeNameUnresolvable
ErrorCodeTemporaryResolverFailure
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/network@0.2.0#ip-address-family".
//
// enum ip-address-family {
// ipv4,
// ipv6
// }
type IPAddressFamily uint8
const (
IPAddressFamilyIPv4 IPAddressFamily = iota
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/network@0.2.0#ipv4-address".
//
// type ipv4-address = tuple<u8, u8, u8, u8>
type IPv4Address [4]uint8
// IPv6Address represents the tuple "wasi:sockets/network@0.2.0#ipv6-address".
//
// type ipv6-address = tuple<u16, u16, u16, u16, u16, u16, u16, u16>
type IPv6Address [8]uint16
// IPAddress represents the variant "wasi:sockets/network@0.2.0#ip-address".
//
// variant ip-address {
// ipv4(ipv4-address),
// ipv6(ipv6-address),
// }
type IPAddress cm.Variant[uint8, IPv6Address, IPv6Address]
// IPAddressIPv4 returns a [IPAddress] of case "ipv4".
func IPAddressIPv4(data IPv4Address) IPAddress {
return cm.New[IPAddress](0, data)
}
// IPv4 returns a non-nil *[IPv4Address] if [IPAddress] represents the variant case "ipv4".
func (self *IPAddress) IPv4() *IPv4Address {
return cm.Case[IPv4Address](self, 0)
}
// IPAddressIPv6 returns a [IPAddress] of case "ipv6".
func IPAddressIPv6(data IPv6Address) IPAddress {
return cm.New[IPAddress](1, data)
}
// IPv6 returns a non-nil *[IPv6Address] if [IPAddress] represents the variant case "ipv6".
func (self *IPAddress) IPv6() *IPv6Address {
return cm.Case[IPv6Address](self, 1)
}
var stringsIPAddress = [2]string{
"ipv4",
"ipv6",
}
// String implements [fmt.Stringer], returning the variant case name of v.
func (v IPAddress) String() string {
return stringsIPAddress[v.Tag()]
}
// IPv4SocketAddress represents the record "wasi:sockets/network@0.2.0#ipv4-socket-address".
//
// record ipv4-socket-address {
// port: u16,
// address: ipv4-address,
// }
type IPv4SocketAddress struct {
_ cm.HostLayout
Port uint16
Address IPv4Address
}
// IPv6SocketAddress represents the record "wasi:sockets/network@0.2.0#ipv6-socket-address".
//
// record ipv6-socket-address {
// port: u16,
// flow-info: u32,
// address: ipv6-address,
// scope-id: u32,
// }
type IPv6SocketAddress struct {
_ cm.HostLayout
Port uint16
FlowInfo uint32
Address IPv6Address
ScopeID uint32
}
// IPSocketAddress represents the variant "wasi:sockets/network@0.2.0#ip-socket-address".
//
// variant ip-socket-address {
// ipv4(ipv4-socket-address),
// ipv6(ipv6-socket-address),
// }
type IPSocketAddress cm.Variant[uint8, IPv6SocketAddressShape, IPv6SocketAddress]
// IPSocketAddressIPv4 returns a [IPSocketAddress] of case "ipv4".
func IPSocketAddressIPv4(data IPv4SocketAddress) IPSocketAddress {
return cm.New[IPSocketAddress](0, data)
}
// IPv4 returns a non-nil *[IPv4SocketAddress] if [IPSocketAddress] represents the variant case "ipv4".
func (self *IPSocketAddress) IPv4() *IPv4SocketAddress {
return cm.Case[IPv4SocketAddress](self, 0)
}
// IPSocketAddressIPv6 returns a [IPSocketAddress] of case "ipv6".
func IPSocketAddressIPv6(data IPv6SocketAddress) IPSocketAddress {
return cm.New[IPSocketAddress](1, data)
}
// IPv6 returns a non-nil *[IPv6SocketAddress] if [IPSocketAddress] represents the variant case "ipv6".
func (self *IPSocketAddress) IPv6() *IPv6SocketAddress {
return cm.Case[IPv6SocketAddress](self, 1)
}
var stringsIPSocketAddress = [2]string{
"ipv4",
"ipv6",
}
// String implements [fmt.Stringer], returning the variant case name of v.
func (v IPSocketAddress) String() string {
return stringsIPSocketAddress[v.Tag()]
}

View File

@ -0,0 +1,3 @@
// This file exists for testing this package without WebAssembly,
// allowing empty function bodies with a //go:wasmimport directive.
// See https://pkg.go.dev/cmd/compile for more information.

View File

@ -0,0 +1,42 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
// Package tcpcreatesocket represents the imported interface "wasi:sockets/tcp-create-socket@0.2.0".
package tcpcreatesocket
import (
"gitea.rebus.ninja/lore/go-nats-client/gen/wasi/sockets/network"
"gitea.rebus.ninja/lore/go-nats-client/gen/wasi/sockets/tcp"
"github.com/bytecodealliance/wasm-tools-go/cm"
)
// Network represents the imported type alias "wasi:sockets/tcp-create-socket@0.2.0#network".
//
// See [network.Network] for more information.
type Network = network.Network
// ErrorCode represents the type alias "wasi:sockets/tcp-create-socket@0.2.0#error-code".
//
// See [network.ErrorCode] for more information.
type ErrorCode = network.ErrorCode
// IPAddressFamily represents the type alias "wasi:sockets/tcp-create-socket@0.2.0#ip-address-family".
//
// See [network.IPAddressFamily] for more information.
type IPAddressFamily = network.IPAddressFamily
// TCPSocket represents the imported type alias "wasi:sockets/tcp-create-socket@0.2.0#tcp-socket".
//
// See [tcp.TCPSocket] for more information.
type TCPSocket = tcp.TCPSocket
// CreateTCPSocket represents the imported function "create-tcp-socket".
//
// create-tcp-socket: func(address-family: ip-address-family) -> result<tcp-socket,
// error-code>
//
//go:nosplit
func CreateTCPSocket(addressFamily IPAddressFamily) (result cm.Result[TCPSocket, TCPSocket, ErrorCode]) {
addressFamily0 := (uint32)(addressFamily)
wasmimport_CreateTCPSocket((uint32)(addressFamily0), &result)
return
}

View File

@ -0,0 +1,13 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
package tcpcreatesocket
import (
"github.com/bytecodealliance/wasm-tools-go/cm"
)
// This file contains wasmimport and wasmexport declarations for "wasi:sockets@0.2.0".
//go:wasmimport wasi:sockets/tcp-create-socket@0.2.0 create-tcp-socket
//go:noescape
func wasmimport_CreateTCPSocket(addressFamily0 uint32, result *cm.Result[TCPSocket, TCPSocket, ErrorCode])

View File

@ -0,0 +1,88 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
package tcp
import (
"gitea.rebus.ninja/lore/go-nats-client/gen/wasi/sockets/network"
"github.com/bytecodealliance/wasm-tools-go/cm"
"unsafe"
)
// TupleTCPSocketInputStreamOutputStreamShape is used for storage in variant or result types.
type TupleTCPSocketInputStreamOutputStreamShape struct {
_ cm.HostLayout
shape [unsafe.Sizeof(cm.Tuple3[TCPSocket, InputStream, OutputStream]{})]byte
}
// TupleInputStreamOutputStreamShape is used for storage in variant or result types.
type TupleInputStreamOutputStreamShape struct {
_ cm.HostLayout
shape [unsafe.Sizeof(cm.Tuple[InputStream, OutputStream]{})]byte
}
// IPSocketAddressShape is used for storage in variant or result types.
type IPSocketAddressShape struct {
_ cm.HostLayout
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])
f2 = (uint32)(v[2])
f3 = (uint32)(v[3])
return
}
func lower_IPv4SocketAddress(v network.IPv4SocketAddress) (f0 uint32, f1 uint32, f2 uint32, f3 uint32, f4 uint32) {
f0 = (uint32)(v.Port)
f1, f2, f3, f4 = lower_IPv4Address(v.Address)
return
}
func lower_IPv6Address(v network.IPv6Address) (f0 uint32, f1 uint32, f2 uint32, f3 uint32, f4 uint32, f5 uint32, f6 uint32, f7 uint32) {
f0 = (uint32)(v[0])
f1 = (uint32)(v[1])
f2 = (uint32)(v[2])
f3 = (uint32)(v[3])
f4 = (uint32)(v[4])
f5 = (uint32)(v[5])
f6 = (uint32)(v[6])
f7 = (uint32)(v[7])
return
}
func lower_IPv6SocketAddress(v network.IPv6SocketAddress) (f0 uint32, f1 uint32, f2 uint32, f3 uint32, f4 uint32, f5 uint32, f6 uint32, f7 uint32, f8 uint32, f9 uint32, f10 uint32) {
f0 = (uint32)(v.Port)
f1 = (uint32)(v.FlowInfo)
f2, f3, f4, f5, f6, f7, f8, f9 = lower_IPv6Address(v.Address)
f10 = (uint32)(v.ScopeID)
return
}
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)(v.Tag())
switch f0 {
case 0: // ipv4
v1, v2, v3, v4, v5 := lower_IPv4SocketAddress(*v.IPv4())
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())
f1 = (uint32)(v1)
f2 = (uint32)(v2)
f3 = (uint32)(v3)
f4 = (uint32)(v4)
f5 = (uint32)(v5)
f6 = (uint32)(v6)
f7 = (uint32)(v7)
f8 = (uint32)(v8)
f9 = (uint32)(v9)
f10 = (uint32)(v10)
f11 = (uint32)(v11)
}
return
}

View File

@ -0,0 +1,3 @@
// This file exists for testing this package without WebAssembly,
// allowing empty function bodies with a //go:wasmimport directive.
// See https://pkg.go.dev/cmd/compile for more information.

View File

@ -0,0 +1,125 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
package tcp
import (
"github.com/bytecodealliance/wasm-tools-go/cm"
)
// This file contains wasmimport and wasmexport declarations for "wasi:sockets@0.2.0".
//go:wasmimport wasi:sockets/tcp@0.2.0 [resource-drop]tcp-socket
//go:noescape
func wasmimport_TCPSocketResourceDrop(self0 uint32)
//go:wasmimport wasi:sockets/tcp@0.2.0 [method]tcp-socket.accept
//go:noescape
func wasmimport_TCPSocketAccept(self0 uint32, result *cm.Result[TupleTCPSocketInputStreamOutputStreamShape, cm.Tuple3[TCPSocket, InputStream, OutputStream], ErrorCode])
//go:wasmimport wasi:sockets/tcp@0.2.0 [method]tcp-socket.address-family
//go:noescape
func wasmimport_TCPSocketAddressFamily(self0 uint32) (result0 uint32)
//go:wasmimport wasi:sockets/tcp@0.2.0 [method]tcp-socket.finish-bind
//go:noescape
func wasmimport_TCPSocketFinishBind(self0 uint32, result *cm.Result[ErrorCode, struct{}, ErrorCode])
//go:wasmimport wasi:sockets/tcp@0.2.0 [method]tcp-socket.finish-connect
//go:noescape
func wasmimport_TCPSocketFinishConnect(self0 uint32, result *cm.Result[TupleInputStreamOutputStreamShape, cm.Tuple[InputStream, OutputStream], ErrorCode])
//go:wasmimport wasi:sockets/tcp@0.2.0 [method]tcp-socket.finish-listen
//go:noescape
func wasmimport_TCPSocketFinishListen(self0 uint32, result *cm.Result[ErrorCode, struct{}, ErrorCode])
//go:wasmimport wasi:sockets/tcp@0.2.0 [method]tcp-socket.hop-limit
//go:noescape
func wasmimport_TCPSocketHopLimit(self0 uint32, result *cm.Result[uint8, uint8, ErrorCode])
//go:wasmimport wasi:sockets/tcp@0.2.0 [method]tcp-socket.is-listening
//go:noescape
func wasmimport_TCPSocketIsListening(self0 uint32) (result0 uint32)
//go:wasmimport wasi:sockets/tcp@0.2.0 [method]tcp-socket.keep-alive-count
//go:noescape
func wasmimport_TCPSocketKeepAliveCount(self0 uint32, result *cm.Result[uint32, uint32, ErrorCode])
//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])
//go:wasmimport wasi:sockets/tcp@0.2.0 [method]tcp-socket.keep-alive-idle-time
//go:noescape
func wasmimport_TCPSocketKeepAliveIdleTime(self0 uint32, result *cm.Result[uint64, Duration, ErrorCode])
//go:wasmimport wasi:sockets/tcp@0.2.0 [method]tcp-socket.keep-alive-interval
//go:noescape
func wasmimport_TCPSocketKeepAliveInterval(self0 uint32, result *cm.Result[uint64, Duration, ErrorCode])
//go:wasmimport wasi:sockets/tcp@0.2.0 [method]tcp-socket.local-address
//go:noescape
func wasmimport_TCPSocketLocalAddress(self0 uint32, result *cm.Result[IPSocketAddressShape, IPSocketAddress, ErrorCode])
//go:wasmimport wasi:sockets/tcp@0.2.0 [method]tcp-socket.receive-buffer-size
//go:noescape
func wasmimport_TCPSocketReceiveBufferSize(self0 uint32, result *cm.Result[uint64, uint64, ErrorCode])
//go:wasmimport wasi:sockets/tcp@0.2.0 [method]tcp-socket.remote-address
//go:noescape
func wasmimport_TCPSocketRemoteAddress(self0 uint32, result *cm.Result[IPSocketAddressShape, IPSocketAddress, ErrorCode])
//go:wasmimport wasi:sockets/tcp@0.2.0 [method]tcp-socket.send-buffer-size
//go:noescape
func wasmimport_TCPSocketSendBufferSize(self0 uint32, result *cm.Result[uint64, uint64, ErrorCode])
//go:wasmimport wasi:sockets/tcp@0.2.0 [method]tcp-socket.set-hop-limit
//go:noescape
func wasmimport_TCPSocketSetHopLimit(self0 uint32, value0 uint32, result *cm.Result[ErrorCode, struct{}, ErrorCode])
//go:wasmimport wasi:sockets/tcp@0.2.0 [method]tcp-socket.set-keep-alive-count
//go:noescape
func wasmimport_TCPSocketSetKeepAliveCount(self0 uint32, value0 uint32, result *cm.Result[ErrorCode, struct{}, ErrorCode])
//go:wasmimport wasi:sockets/tcp@0.2.0 [method]tcp-socket.set-keep-alive-enabled
//go:noescape
func wasmimport_TCPSocketSetKeepAliveEnabled(self0 uint32, value0 uint32, result *cm.Result[ErrorCode, struct{}, ErrorCode])
//go:wasmimport wasi:sockets/tcp@0.2.0 [method]tcp-socket.set-keep-alive-idle-time
//go:noescape
func wasmimport_TCPSocketSetKeepAliveIdleTime(self0 uint32, value0 uint64, result *cm.Result[ErrorCode, struct{}, ErrorCode])
//go:wasmimport wasi:sockets/tcp@0.2.0 [method]tcp-socket.set-keep-alive-interval
//go:noescape
func wasmimport_TCPSocketSetKeepAliveInterval(self0 uint32, value0 uint64, result *cm.Result[ErrorCode, struct{}, ErrorCode])
//go:wasmimport wasi:sockets/tcp@0.2.0 [method]tcp-socket.set-listen-backlog-size
//go:noescape
func wasmimport_TCPSocketSetListenBacklogSize(self0 uint32, value0 uint64, result *cm.Result[ErrorCode, struct{}, ErrorCode])
//go:wasmimport wasi:sockets/tcp@0.2.0 [method]tcp-socket.set-receive-buffer-size
//go:noescape
func wasmimport_TCPSocketSetReceiveBufferSize(self0 uint32, value0 uint64, result *cm.Result[ErrorCode, struct{}, ErrorCode])
//go:wasmimport wasi:sockets/tcp@0.2.0 [method]tcp-socket.set-send-buffer-size
//go:noescape
func wasmimport_TCPSocketSetSendBufferSize(self0 uint32, value0 uint64, result *cm.Result[ErrorCode, struct{}, ErrorCode])
//go:wasmimport wasi:sockets/tcp@0.2.0 [method]tcp-socket.shutdown
//go:noescape
func wasmimport_TCPSocketShutdown(self0 uint32, shutdownType0 uint32, result *cm.Result[ErrorCode, struct{}, ErrorCode])
//go:wasmimport wasi:sockets/tcp@0.2.0 [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.Result[ErrorCode, struct{}, ErrorCode])
//go:wasmimport wasi:sockets/tcp@0.2.0 [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.Result[ErrorCode, struct{}, ErrorCode])
//go:wasmimport wasi:sockets/tcp@0.2.0 [method]tcp-socket.start-listen
//go:noescape
func wasmimport_TCPSocketStartListen(self0 uint32, result *cm.Result[ErrorCode, struct{}, ErrorCode])
//go:wasmimport wasi:sockets/tcp@0.2.0 [method]tcp-socket.subscribe
//go:noescape
func wasmimport_TCPSocketSubscribe(self0 uint32) (result0 uint32)

View File

@ -0,0 +1,420 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
// Package tcp represents the imported interface "wasi:sockets/tcp@0.2.0".
package tcp
import (
monotonicclock "gitea.rebus.ninja/lore/go-nats-client/gen/wasi/clocks/monotonic-clock"
"gitea.rebus.ninja/lore/go-nats-client/gen/wasi/io/poll"
"gitea.rebus.ninja/lore/go-nats-client/gen/wasi/io/streams"
"gitea.rebus.ninja/lore/go-nats-client/gen/wasi/sockets/network"
"github.com/bytecodealliance/wasm-tools-go/cm"
)
// InputStream represents the imported type alias "wasi:sockets/tcp@0.2.0#input-stream".
//
// See [streams.InputStream] for more information.
type InputStream = streams.InputStream
// OutputStream represents the imported type alias "wasi:sockets/tcp@0.2.0#output-stream".
//
// See [streams.OutputStream] for more information.
type OutputStream = streams.OutputStream
// Pollable represents the imported type alias "wasi:sockets/tcp@0.2.0#pollable".
//
// See [poll.Pollable] for more information.
type Pollable = poll.Pollable
// Duration represents the type alias "wasi:sockets/tcp@0.2.0#duration".
//
// See [monotonicclock.Duration] for more information.
type Duration = monotonicclock.Duration
// Network represents the imported type alias "wasi:sockets/tcp@0.2.0#network".
//
// See [network.Network] for more information.
type Network = network.Network
// ErrorCode represents the type alias "wasi:sockets/tcp@0.2.0#error-code".
//
// See [network.ErrorCode] for more information.
type ErrorCode = network.ErrorCode
// IPSocketAddress represents the type alias "wasi:sockets/tcp@0.2.0#ip-socket-address".
//
// See [network.IPSocketAddress] for more information.
type IPSocketAddress = network.IPSocketAddress
// IPAddressFamily represents the type alias "wasi:sockets/tcp@0.2.0#ip-address-family".
//
// See [network.IPAddressFamily] for more information.
type IPAddressFamily = network.IPAddressFamily
// ShutdownType represents the enum "wasi:sockets/tcp@0.2.0#shutdown-type".
//
// enum shutdown-type {
// receive,
// send,
// both
// }
type ShutdownType uint8
const (
ShutdownTypeReceive ShutdownType = iota
ShutdownTypeSend
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/tcp@0.2.0#tcp-socket".
//
// resource tcp-socket
type TCPSocket cm.Resource
// ResourceDrop represents the imported resource-drop for resource "tcp-socket".
//
// Drops a resource handle.
//
//go:nosplit
func (self TCPSocket) ResourceDrop() {
self0 := cm.Reinterpret[uint32](self)
wasmimport_TCPSocketResourceDrop((uint32)(self0))
return
}
// Accept represents the imported method "accept".
//
// accept: func() -> result<tuple<tcp-socket, input-stream, output-stream>, error-code>
//
//go:nosplit
func (self TCPSocket) Accept() (result cm.Result[TupleTCPSocketInputStreamOutputStreamShape, cm.Tuple3[TCPSocket, InputStream, OutputStream], ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
wasmimport_TCPSocketAccept((uint32)(self0), &result)
return
}
// AddressFamily represents the imported method "address-family".
//
// address-family: func() -> ip-address-family
//
//go:nosplit
func (self TCPSocket) AddressFamily() (result IPAddressFamily) {
self0 := cm.Reinterpret[uint32](self)
result0 := wasmimport_TCPSocketAddressFamily((uint32)(self0))
result = (network.IPAddressFamily)((uint32)(result0))
return
}
// FinishBind represents the imported method "finish-bind".
//
// finish-bind: func() -> result<_, error-code>
//
//go:nosplit
func (self TCPSocket) FinishBind() (result cm.Result[ErrorCode, struct{}, ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
wasmimport_TCPSocketFinishBind((uint32)(self0), &result)
return
}
// 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.Result[TupleInputStreamOutputStreamShape, cm.Tuple[InputStream, OutputStream], ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
wasmimport_TCPSocketFinishConnect((uint32)(self0), &result)
return
}
// FinishListen represents the imported method "finish-listen".
//
// finish-listen: func() -> result<_, error-code>
//
//go:nosplit
func (self TCPSocket) FinishListen() (result cm.Result[ErrorCode, struct{}, ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
wasmimport_TCPSocketFinishListen((uint32)(self0), &result)
return
}
// HopLimit represents the imported method "hop-limit".
//
// hop-limit: func() -> result<u8, error-code>
//
//go:nosplit
func (self TCPSocket) HopLimit() (result cm.Result[uint8, uint8, ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
wasmimport_TCPSocketHopLimit((uint32)(self0), &result)
return
}
// IsListening represents the imported method "is-listening".
//
// is-listening: func() -> bool
//
//go:nosplit
func (self TCPSocket) IsListening() (result bool) {
self0 := cm.Reinterpret[uint32](self)
result0 := wasmimport_TCPSocketIsListening((uint32)(self0))
result = cm.U32ToBool((uint32)(result0))
return
}
// KeepAliveCount represents the imported method "keep-alive-count".
//
// keep-alive-count: func() -> result<u32, error-code>
//
//go:nosplit
func (self TCPSocket) KeepAliveCount() (result cm.Result[uint32, uint32, ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
wasmimport_TCPSocketKeepAliveCount((uint32)(self0), &result)
return
}
// KeepAliveEnabled represents the imported method "keep-alive-enabled".
//
// keep-alive-enabled: func() -> result<bool, error-code>
//
//go:nosplit
func (self TCPSocket) KeepAliveEnabled() (result cm.Result[bool, bool, ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
wasmimport_TCPSocketKeepAliveEnabled((uint32)(self0), &result)
return
}
// KeepAliveIdleTime represents the imported method "keep-alive-idle-time".
//
// keep-alive-idle-time: func() -> result<duration, error-code>
//
//go:nosplit
func (self TCPSocket) KeepAliveIdleTime() (result cm.Result[uint64, Duration, ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
wasmimport_TCPSocketKeepAliveIdleTime((uint32)(self0), &result)
return
}
// KeepAliveInterval represents the imported method "keep-alive-interval".
//
// keep-alive-interval: func() -> result<duration, error-code>
//
//go:nosplit
func (self TCPSocket) KeepAliveInterval() (result cm.Result[uint64, Duration, ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
wasmimport_TCPSocketKeepAliveInterval((uint32)(self0), &result)
return
}
// LocalAddress represents the imported method "local-address".
//
// local-address: func() -> result<ip-socket-address, error-code>
//
//go:nosplit
func (self TCPSocket) LocalAddress() (result cm.Result[IPSocketAddressShape, IPSocketAddress, ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
wasmimport_TCPSocketLocalAddress((uint32)(self0), &result)
return
}
// ReceiveBufferSize represents the imported method "receive-buffer-size".
//
// receive-buffer-size: func() -> result<u64, error-code>
//
//go:nosplit
func (self TCPSocket) ReceiveBufferSize() (result cm.Result[uint64, uint64, ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
wasmimport_TCPSocketReceiveBufferSize((uint32)(self0), &result)
return
}
// RemoteAddress represents the imported method "remote-address".
//
// remote-address: func() -> result<ip-socket-address, error-code>
//
//go:nosplit
func (self TCPSocket) RemoteAddress() (result cm.Result[IPSocketAddressShape, IPSocketAddress, ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
wasmimport_TCPSocketRemoteAddress((uint32)(self0), &result)
return
}
// SendBufferSize represents the imported method "send-buffer-size".
//
// send-buffer-size: func() -> result<u64, error-code>
//
//go:nosplit
func (self TCPSocket) SendBufferSize() (result cm.Result[uint64, uint64, ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
wasmimport_TCPSocketSendBufferSize((uint32)(self0), &result)
return
}
// 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.Result[ErrorCode, struct{}, ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
value0 := (uint32)(value)
wasmimport_TCPSocketSetHopLimit((uint32)(self0), (uint32)(value0), &result)
return
}
// 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.Result[ErrorCode, struct{}, ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
value0 := (uint32)(value)
wasmimport_TCPSocketSetKeepAliveCount((uint32)(self0), (uint32)(value0), &result)
return
}
// 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.Result[ErrorCode, struct{}, ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
value0 := cm.BoolToU32(value)
wasmimport_TCPSocketSetKeepAliveEnabled((uint32)(self0), (uint32)(value0), &result)
return
}
// 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 Duration) (result cm.Result[ErrorCode, struct{}, ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
value0 := (uint64)(value)
wasmimport_TCPSocketSetKeepAliveIdleTime((uint32)(self0), (uint64)(value0), &result)
return
}
// 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 Duration) (result cm.Result[ErrorCode, struct{}, ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
value0 := (uint64)(value)
wasmimport_TCPSocketSetKeepAliveInterval((uint32)(self0), (uint64)(value0), &result)
return
}
// SetListenBacklogSize represents the imported method "set-listen-backlog-size".
//
// set-listen-backlog-size: func(value: u64) -> result<_, error-code>
//
//go:nosplit
func (self TCPSocket) SetListenBacklogSize(value uint64) (result cm.Result[ErrorCode, struct{}, ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
value0 := (uint64)(value)
wasmimport_TCPSocketSetListenBacklogSize((uint32)(self0), (uint64)(value0), &result)
return
}
// 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.Result[ErrorCode, struct{}, ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
value0 := (uint64)(value)
wasmimport_TCPSocketSetReceiveBufferSize((uint32)(self0), (uint64)(value0), &result)
return
}
// 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.Result[ErrorCode, struct{}, ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
value0 := (uint64)(value)
wasmimport_TCPSocketSetSendBufferSize((uint32)(self0), (uint64)(value0), &result)
return
}
// Shutdown represents the imported method "shutdown".
//
// shutdown: func(shutdown-type: shutdown-type) -> result<_, error-code>
//
//go:nosplit
func (self TCPSocket) Shutdown(shutdownType ShutdownType) (result cm.Result[ErrorCode, struct{}, ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
shutdownType0 := (uint32)(shutdownType)
wasmimport_TCPSocketShutdown((uint32)(self0), (uint32)(shutdownType0), &result)
return
}
// StartBind represents the imported method "start-bind".
//
// start-bind: func(network: borrow<network>, local-address: ip-socket-address) ->
// result<_, error-code>
//
//go:nosplit
func (self TCPSocket) StartBind(network_ Network, localAddress IPSocketAddress) (result cm.Result[ErrorCode, struct{}, 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)
wasmimport_TCPSocketStartBind((uint32)(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), &result)
return
}
// StartConnect represents the imported method "start-connect".
//
// start-connect: func(network: borrow<network>, remote-address: ip-socket-address)
// -> result<_, error-code>
//
//go:nosplit
func (self TCPSocket) StartConnect(network_ Network, remoteAddress IPSocketAddress) (result cm.Result[ErrorCode, struct{}, 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)
wasmimport_TCPSocketStartConnect((uint32)(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), &result)
return
}
// StartListen represents the imported method "start-listen".
//
// start-listen: func() -> result<_, error-code>
//
//go:nosplit
func (self TCPSocket) StartListen() (result cm.Result[ErrorCode, struct{}, ErrorCode]) {
self0 := cm.Reinterpret[uint32](self)
wasmimport_TCPSocketStartListen((uint32)(self0), &result)
return
}
// Subscribe represents the imported method "subscribe".
//
// subscribe: func() -> pollable
//
//go:nosplit
func (self TCPSocket) Subscribe() (result Pollable) {
self0 := cm.Reinterpret[uint32](self)
result0 := wasmimport_TCPSocketSubscribe((uint32)(self0))
result = cm.Reinterpret[Pollable]((uint32)(result0))
return
}

View File

@ -0,0 +1,3 @@
// This file exists for testing this package without WebAssembly,
// allowing empty function bodies with a //go:wasmimport directive.
// See https://pkg.go.dev/cmd/compile for more information.

View File

@ -0,0 +1,42 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
// Package udpcreatesocket represents the imported interface "wasi:sockets/udp-create-socket@0.2.0".
package udpcreatesocket
import (
"gitea.rebus.ninja/lore/go-nats-client/gen/wasi/sockets/network"
"gitea.rebus.ninja/lore/go-nats-client/gen/wasi/sockets/udp"
"github.com/bytecodealliance/wasm-tools-go/cm"
)
// Network represents the imported type alias "wasi:sockets/udp-create-socket@0.2.0#network".
//
// See [network.Network] for more information.
type Network = network.Network
// ErrorCode represents the type alias "wasi:sockets/udp-create-socket@0.2.0#error-code".
//
// See [network.ErrorCode] for more information.
type ErrorCode = network.ErrorCode
// IPAddressFamily represents the type alias "wasi:sockets/udp-create-socket@0.2.0#ip-address-family".
//
// See [network.IPAddressFamily] for more information.
type IPAddressFamily = network.IPAddressFamily
// UDPSocket represents the imported type alias "wasi:sockets/udp-create-socket@0.2.0#udp-socket".
//
// See [udp.UDPSocket] for more information.
type UDPSocket = udp.UDPSocket
// CreateUDPSocket represents the imported function "create-udp-socket".
//
// create-udp-socket: func(address-family: ip-address-family) -> result<udp-socket,
// error-code>
//
//go:nosplit
func CreateUDPSocket(addressFamily IPAddressFamily) (result cm.Result[UDPSocket, UDPSocket, ErrorCode]) {
addressFamily0 := (uint32)(addressFamily)
wasmimport_CreateUDPSocket((uint32)(addressFamily0), &result)
return
}

View File

@ -0,0 +1,13 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
package udpcreatesocket
import (
"github.com/bytecodealliance/wasm-tools-go/cm"
)
// This file contains wasmimport and wasmexport declarations for "wasi:sockets@0.2.0".
//go:wasmimport wasi:sockets/udp-create-socket@0.2.0 create-udp-socket
//go:noescape
func wasmimport_CreateUDPSocket(addressFamily0 uint32, result *cm.Result[UDPSocket, UDPSocket, ErrorCode])

103
gen/wasi/sockets/udp/abi.go Normal file
View File

@ -0,0 +1,103 @@
// Code generated by wit-bindgen-go. DO NOT EDIT.
package udp
import (
"gitea.rebus.ninja/lore/go-nats-client/gen/wasi/sockets/network"
"github.com/bytecodealliance/wasm-tools-go/cm"
"unsafe"
)
// IPSocketAddressShape is used for storage in variant or result types.
type IPSocketAddressShape struct {
_ cm.HostLayout
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])
f2 = (uint32)(v[2])
f3 = (uint32)(v[3])
return
}
func lower_IPv4SocketAddress(v network.IPv4SocketAddress) (f0 uint32, f1 uint32, f2 uint32, f3 uint32, f4 uint32) {
f0 = (uint32)(v.Port)
f1, f2, f3, f4 = lower_IPv4Address(v.Address)
return
}
func lower_IPv6Address(v network.IPv6Address) (f0 uint32, f1 uint32, f2 uint32, f3 uint32, f4 uint32, f5 uint32, f6 uint32, f7 uint32) {
f0 = (uint32)(v[0])
f1 = (uint32)(v[1])
f2 = (uint32)(v[2])
f3 = (uint32)(v[3])
f4 = (uint32)(v[4])
f5 = (uint32)(v[5])
f6 = (uint32)(v[6])
f7 = (uint32)(v[7])
return
}
func lower_IPv6SocketAddress(v network.IPv6SocketAddress) (f0 uint32, f1 uint32, f2 uint32, f3 uint32, f4 uint32, f5 uint32, f6 uint32, f7 uint32, f8 uint32, f9 uint32, f10 uint32) {
f0 = (uint32)(v.Port)
f1 = (uint32)(v.FlowInfo)
f2, f3, f4, f5, f6, f7, f8, f9 = lower_IPv6Address(v.Address)
f10 = (uint32)(v.ScopeID)
return
}
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)(v.Tag())
switch f0 {
case 0: // ipv4
v1, v2, v3, v4, v5 := lower_IPv4SocketAddress(*v.IPv4())
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())
f1 = (uint32)(v1)
f2 = (uint32)(v2)
f3 = (uint32)(v3)
f4 = (uint32)(v4)
f5 = (uint32)(v5)
f6 = (uint32)(v6)
f7 = (uint32)(v7)
f8 = (uint32)(v8)
f9 = (uint32)(v9)
f10 = (uint32)(v10)
f11 = (uint32)(v11)
}
return
}
// TupleIncomingDatagramStreamOutgoingDatagramStreamShape is used for storage in variant or result types.
type TupleIncomingDatagramStreamOutgoingDatagramStreamShape struct {
_ cm.HostLayout
shape [unsafe.Sizeof(cm.Tuple[IncomingDatagramStream, OutgoingDatagramStream]{})]byte
}
func lower_OptionIPSocketAddress(v cm.Option[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 {
f0 = 1
v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12 := lower_IPSocketAddress(*some)
f1 = (uint32)(v1)
f2 = (uint32)(v2)
f3 = (uint32)(v3)
f4 = (uint32)(v4)
f5 = (uint32)(v5)
f6 = (uint32)(v6)
f7 = (uint32)(v7)
f8 = (uint32)(v8)
f9 = (uint32)(v9)
f10 = (uint32)(v10)
f11 = (uint32)(v11)
f12 = (uint32)(v12)
}
return
}

View File

@ -0,0 +1,3 @@
// This file exists for testing this package without WebAssembly,
// allowing empty function bodies with a //go:wasmimport directive.
// See https://pkg.go.dev/cmd/compile for more information.

Some files were not shown because too many files have changed in this diff Show More