mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-06 12:03:41 +00:00
internal/{cm,wasi}: regenerate WASI 0.2 bindings with wasm-tools-go v0.3.0
This commit is contained in:
+28
-4
@@ -2,6 +2,11 @@ package cm
|
||||
|
||||
import "unsafe"
|
||||
|
||||
// AnyInteger is a type constraint for any integer type.
|
||||
type AnyInteger interface {
|
||||
~int | ~uint | ~uintptr | ~int8 | ~uint8 | ~int16 | ~uint16 | ~int32 | ~uint32 | ~int64 | ~uint64
|
||||
}
|
||||
|
||||
// Reinterpret reinterprets the bits of type From into type T.
|
||||
// Will panic if the size of From is smaller than the size of To.
|
||||
func Reinterpret[T, From any](from From) (to T) {
|
||||
@@ -19,19 +24,19 @@ func LowerString[S ~string](s S) (*byte, uint32) {
|
||||
}
|
||||
|
||||
// LiftString lifts Core WebAssembly types into a [string].
|
||||
func LiftString[T ~string, Data unsafe.Pointer | uintptr | *uint8, Len uint | uintptr | uint32 | uint64](data Data, len Len) T {
|
||||
func LiftString[T ~string, Data unsafe.Pointer | uintptr | *uint8, Len AnyInteger](data Data, len Len) T {
|
||||
return T(unsafe.String((*uint8)(unsafe.Pointer(data)), int(len)))
|
||||
}
|
||||
|
||||
// LowerList lowers a [List] into a pair of Core WebAssembly types.
|
||||
func LowerList[L ~struct{ list[T] }, T any](list L) (*T, uint32) {
|
||||
func LowerList[L AnyList[T], T any](list L) (*T, uint32) {
|
||||
l := (*List[T])(unsafe.Pointer(&list))
|
||||
return l.data, uint32(l.len)
|
||||
}
|
||||
|
||||
// LiftList lifts Core WebAssembly types into a [List].
|
||||
func LiftList[L List[T], T any, Data unsafe.Pointer | uintptr | *T, Len uint | uintptr | uint32 | uint64](data Data, len Len) L {
|
||||
return L(NewList((*T)(unsafe.Pointer(data)), uint(len)))
|
||||
func LiftList[L AnyList[T], T any, Data unsafe.Pointer | uintptr | *T, Len AnyInteger](data Data, len Len) L {
|
||||
return L(NewList((*T)(unsafe.Pointer(data)), len))
|
||||
}
|
||||
|
||||
// BoolToU32 converts a value whose underlying type is [bool] into a [uint32].
|
||||
@@ -84,6 +89,25 @@ func F64ToU64(v float64) uint64 { return *(*uint64)(unsafe.Pointer(&v)) }
|
||||
// [Canonical ABI]: https://github.com/WebAssembly/component-model/blob/main/design/mvp/CanonicalABI.md
|
||||
func U64ToF64(v uint64) float64 { return *(*float64)(unsafe.Pointer(&v)) }
|
||||
|
||||
// F32ToU64 maps the bits of a [float32] into a [uint64].
|
||||
// Used to lower a [float32] into a Core WebAssembly i64 when required by the [Canonical ABI].
|
||||
//
|
||||
// [float32]: https://pkg.go.dev/builtin#float32
|
||||
// [uint64]: https://pkg.go.dev/builtin#uint64
|
||||
// [Canonical ABI]: https://github.com/WebAssembly/component-model/blob/main/design/mvp/CanonicalABI.md
|
||||
func F32ToU64(v float32) uint64 { return uint64(*(*uint32)(unsafe.Pointer(&v))) }
|
||||
|
||||
// U64ToF32 maps the bits of a [uint64] into a [float32].
|
||||
// Used to lift a Core WebAssembly i64 into a [float32] when required by the [Canonical ABI].
|
||||
//
|
||||
// [uint64]: https://pkg.go.dev/builtin#uint64
|
||||
// [float32]: https://pkg.go.dev/builtin#float32
|
||||
// [Canonical ABI]: https://github.com/WebAssembly/component-model/blob/main/design/mvp/CanonicalABI.md
|
||||
func U64ToF32(v uint64) float32 {
|
||||
truncated := uint32(v)
|
||||
return *(*float32)(unsafe.Pointer(&truncated))
|
||||
}
|
||||
|
||||
// PointerToU32 converts a pointer of type *T into a [uint32].
|
||||
// Used to lower a pointer into a Core WebAssembly i32 as specified in the [Canonical ABI].
|
||||
//
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
//go:build !go1.23
|
||||
|
||||
package cm
|
||||
|
||||
// HostLayout marks a struct as using host memory layout.
|
||||
// See [structs.HostLayout] in Go 1.23 or later.
|
||||
type HostLayout struct {
|
||||
_ hostLayout // prevent accidental conversion with plain struct{}
|
||||
}
|
||||
|
||||
type hostLayout struct{}
|
||||
@@ -0,0 +1,9 @@
|
||||
//go:build go1.23
|
||||
|
||||
package cm
|
||||
|
||||
import "structs"
|
||||
|
||||
// HostLayout marks a struct as using host memory layout.
|
||||
// See [structs.HostLayout] in Go 1.23 or later.
|
||||
type HostLayout = structs.HostLayout
|
||||
+20
-8
@@ -4,14 +4,25 @@ import "unsafe"
|
||||
|
||||
// List represents a Component Model list.
|
||||
// The binary representation of list<T> is similar to a Go slice minus the cap field.
|
||||
type List[T any] struct{ list[T] }
|
||||
type List[T any] struct {
|
||||
_ HostLayout
|
||||
list[T]
|
||||
}
|
||||
|
||||
// AnyList is a type constraint for generic functions that accept any [List] type.
|
||||
type AnyList[T any] interface {
|
||||
~struct {
|
||||
_ HostLayout
|
||||
list[T]
|
||||
}
|
||||
}
|
||||
|
||||
// NewList returns a List[T] from data and len.
|
||||
func NewList[T any](data *T, len uint) List[T] {
|
||||
func NewList[T any, Len AnyInteger](data *T, len Len) List[T] {
|
||||
return List[T]{
|
||||
list[T]{
|
||||
list: list[T]{
|
||||
data: data,
|
||||
len: len,
|
||||
len: uintptr(len),
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -20,15 +31,16 @@ func NewList[T any](data *T, len uint) List[T] {
|
||||
// The underlying slice data is not copied, and the resulting List points at the
|
||||
// same array storage as the slice.
|
||||
func ToList[S ~[]T, T any](s S) List[T] {
|
||||
return NewList[T](unsafe.SliceData([]T(s)), uint(len(s)))
|
||||
return NewList[T](unsafe.SliceData([]T(s)), uintptr(len(s)))
|
||||
}
|
||||
|
||||
// list represents the internal representation of a Component Model list.
|
||||
// It is intended to be embedded in a [List], so embedding types maintain
|
||||
// the methods defined on this type.
|
||||
type list[T any] struct {
|
||||
_ HostLayout
|
||||
data *T
|
||||
len uint
|
||||
len uintptr
|
||||
}
|
||||
|
||||
// Slice returns a Go slice representing the List.
|
||||
@@ -42,7 +54,7 @@ func (l list[T]) Data() *T {
|
||||
}
|
||||
|
||||
// Len returns the length of the list.
|
||||
// TODO: should this return an int instead of a uint?
|
||||
func (l list[T]) Len() uint {
|
||||
// TODO: should this return an int instead of a uintptr?
|
||||
func (l list[T]) Len() uintptr {
|
||||
return l.len
|
||||
}
|
||||
|
||||
@@ -3,7 +3,10 @@ package cm
|
||||
// Option represents a Component Model [option<T>] type.
|
||||
//
|
||||
// [option<T>]: https://component-model.bytecodealliance.org/design/wit.html#options
|
||||
type Option[T any] struct{ option[T] }
|
||||
type Option[T any] struct {
|
||||
_ HostLayout
|
||||
option[T]
|
||||
}
|
||||
|
||||
// None returns an [Option] representing the none case,
|
||||
// equivalent to the zero value.
|
||||
@@ -14,7 +17,7 @@ func None[T any]() Option[T] {
|
||||
// Some returns an [Option] representing the some case.
|
||||
func Some[T any](v T) Option[T] {
|
||||
return Option[T]{
|
||||
option[T]{
|
||||
option: option[T]{
|
||||
isSome: true,
|
||||
some: v,
|
||||
},
|
||||
@@ -25,6 +28,7 @@ func Some[T any](v T) Option[T] {
|
||||
// The first byte is a bool representing none or some,
|
||||
// followed by storage for the associated type T.
|
||||
type option[T any] struct {
|
||||
_ HostLayout
|
||||
isSome bool
|
||||
some T
|
||||
}
|
||||
@@ -42,3 +46,14 @@ func (o *option[T]) Some() *T {
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Value returns T if o represents the some case,
|
||||
// or the zero value of T if o represents the none case.
|
||||
// This does not have a pointer receiver, so it can be chained.
|
||||
func (o option[T]) Value() T {
|
||||
if !o.isSome {
|
||||
var zero T
|
||||
return zero
|
||||
}
|
||||
return o.some
|
||||
}
|
||||
|
||||
@@ -17,10 +17,22 @@ type BoolResult bool
|
||||
// Result represents a result sized to hold the Shape type.
|
||||
// The size of the Shape type must be greater than or equal to the size of OK and Err types.
|
||||
// For results with two zero-length types, use [BoolResult].
|
||||
type Result[Shape, OK, Err any] struct{ result[Shape, OK, Err] }
|
||||
type Result[Shape, OK, Err any] struct {
|
||||
_ HostLayout
|
||||
result[Shape, OK, Err]
|
||||
}
|
||||
|
||||
// AnyResult is a type constraint for generic functions that accept any [Result] type.
|
||||
type AnyResult[Shape, OK, Err any] interface {
|
||||
~struct {
|
||||
_ HostLayout
|
||||
result[Shape, OK, Err]
|
||||
}
|
||||
}
|
||||
|
||||
// result represents the internal representation of a Component Model result type.
|
||||
type result[Shape, OK, Err any] struct {
|
||||
_ HostLayout
|
||||
isErr bool
|
||||
_ [0]OK
|
||||
_ [0]Err
|
||||
@@ -88,8 +100,8 @@ func (r *result[Shape, OK, Err]) validate() {
|
||||
|
||||
// OK returns an OK result with shape Shape and type OK and Err.
|
||||
// Pass Result[OK, OK, Err] or Result[Err, OK, Err] as the first type argument.
|
||||
func OK[R ~struct{ result[Shape, OK, Err] }, Shape, OK, Err any](ok OK) R {
|
||||
var r struct{ result[Shape, OK, Err] }
|
||||
func OK[R AnyResult[Shape, OK, Err], Shape, OK, Err any](ok OK) R {
|
||||
var r Result[Shape, OK, Err]
|
||||
r.validate()
|
||||
r.isErr = ResultOK
|
||||
*((*OK)(unsafe.Pointer(&r.data))) = ok
|
||||
@@ -98,8 +110,8 @@ func OK[R ~struct{ result[Shape, OK, Err] }, Shape, OK, Err any](ok OK) R {
|
||||
|
||||
// Err returns an error result with shape Shape and type OK and Err.
|
||||
// Pass Result[OK, OK, Err] or Result[Err, OK, Err] as the first type argument.
|
||||
func Err[R ~struct{ result[Shape, OK, Err] }, Shape, OK, Err any](err Err) R {
|
||||
var r struct{ result[Shape, OK, Err] }
|
||||
func Err[R AnyResult[Shape, OK, Err], Shape, OK, Err any](err Err) R {
|
||||
var r Result[Shape, OK, Err]
|
||||
r.validate()
|
||||
r.isErr = ResultErr
|
||||
*((*Err)(unsafe.Pointer(&r.data))) = err
|
||||
|
||||
@@ -4,6 +4,7 @@ package cm
|
||||
//
|
||||
// [Component Model tuple]: https://component-model.bytecodealliance.org/design/wit.html#tuples
|
||||
type Tuple[T0, T1 any] struct {
|
||||
_ HostLayout
|
||||
F0 T0
|
||||
F1 T1
|
||||
}
|
||||
@@ -12,6 +13,7 @@ type Tuple[T0, T1 any] struct {
|
||||
//
|
||||
// [Component Model tuple]: https://component-model.bytecodealliance.org/design/wit.html#tuples
|
||||
type Tuple3[T0, T1, T2 any] struct {
|
||||
_ HostLayout
|
||||
F0 T0
|
||||
F1 T1
|
||||
F2 T2
|
||||
@@ -21,6 +23,7 @@ type Tuple3[T0, T1, T2 any] struct {
|
||||
//
|
||||
// [Component Model tuple]: https://component-model.bytecodealliance.org/design/wit.html#tuples
|
||||
type Tuple4[T0, T1, T2, T3 any] struct {
|
||||
_ HostLayout
|
||||
F0 T0
|
||||
F1 T1
|
||||
F2 T2
|
||||
@@ -31,6 +34,7 @@ type Tuple4[T0, T1, T2, T3 any] struct {
|
||||
//
|
||||
// [Component Model tuple]: https://component-model.bytecodealliance.org/design/wit.html#tuples
|
||||
type Tuple5[T0, T1, T2, T3, T4 any] struct {
|
||||
_ HostLayout
|
||||
F0 T0
|
||||
F1 T1
|
||||
F2 T2
|
||||
@@ -42,6 +46,7 @@ type Tuple5[T0, T1, T2, T3, T4 any] struct {
|
||||
//
|
||||
// [Component Model tuple]: https://component-model.bytecodealliance.org/design/wit.html#tuples
|
||||
type Tuple6[T0, T1, T2, T3, T4, T5 any] struct {
|
||||
_ HostLayout
|
||||
F0 T0
|
||||
F1 T1
|
||||
F2 T2
|
||||
@@ -54,6 +59,7 @@ type Tuple6[T0, T1, T2, T3, T4, T5 any] struct {
|
||||
//
|
||||
// [Component Model tuple]: https://component-model.bytecodealliance.org/design/wit.html#tuples
|
||||
type Tuple7[T0, T1, T2, T3, T4, T5, T6 any] struct {
|
||||
_ HostLayout
|
||||
F0 T0
|
||||
F1 T1
|
||||
F2 T2
|
||||
@@ -67,6 +73,7 @@ type Tuple7[T0, T1, T2, T3, T4, T5, T6 any] struct {
|
||||
//
|
||||
// [Component Model tuple]: https://component-model.bytecodealliance.org/design/wit.html#tuples
|
||||
type Tuple8[T0, T1, T2, T3, T4, T5, T6, T7 any] struct {
|
||||
_ HostLayout
|
||||
F0 T0
|
||||
F1 T1
|
||||
F2 T2
|
||||
@@ -81,6 +88,7 @@ type Tuple8[T0, T1, T2, T3, T4, T5, T6, T7 any] struct {
|
||||
//
|
||||
// [Component Model tuple]: https://component-model.bytecodealliance.org/design/wit.html#tuples
|
||||
type Tuple9[T0, T1, T2, T3, T4, T5, T6, T7, T8 any] struct {
|
||||
_ HostLayout
|
||||
F0 T0
|
||||
F1 T1
|
||||
F2 T2
|
||||
@@ -96,6 +104,7 @@ type Tuple9[T0, T1, T2, T3, T4, T5, T6, T7, T8 any] struct {
|
||||
//
|
||||
// [Component Model tuple]: https://component-model.bytecodealliance.org/design/wit.html#tuples
|
||||
type Tuple10[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9 any] struct {
|
||||
_ HostLayout
|
||||
F0 T0
|
||||
F1 T1
|
||||
F2 T2
|
||||
@@ -112,6 +121,7 @@ type Tuple10[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9 any] struct {
|
||||
//
|
||||
// [Component Model tuple]: https://component-model.bytecodealliance.org/design/wit.html#tuples
|
||||
type Tuple11[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10 any] struct {
|
||||
_ HostLayout
|
||||
F0 T0
|
||||
F1 T1
|
||||
F2 T2
|
||||
@@ -129,6 +139,7 @@ type Tuple11[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10 any] struct {
|
||||
//
|
||||
// [Component Model tuple]: https://component-model.bytecodealliance.org/design/wit.html#tuples
|
||||
type Tuple12[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11 any] struct {
|
||||
_ HostLayout
|
||||
F0 T0
|
||||
F1 T1
|
||||
F2 T2
|
||||
@@ -147,6 +158,7 @@ type Tuple12[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11 any] struct {
|
||||
//
|
||||
// [Component Model tuple]: https://component-model.bytecodealliance.org/design/wit.html#tuples
|
||||
type Tuple13[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12 any] struct {
|
||||
_ HostLayout
|
||||
F0 T0
|
||||
F1 T1
|
||||
F2 T2
|
||||
@@ -166,6 +178,7 @@ type Tuple13[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12 any] struct {
|
||||
//
|
||||
// [Component Model tuple]: https://component-model.bytecodealliance.org/design/wit.html#tuples
|
||||
type Tuple14[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13 any] struct {
|
||||
_ HostLayout
|
||||
F0 T0
|
||||
F1 T1
|
||||
F2 T2
|
||||
@@ -186,6 +199,7 @@ type Tuple14[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13 any] str
|
||||
//
|
||||
// [Component Model tuple]: https://component-model.bytecodealliance.org/design/wit.html#tuples
|
||||
type Tuple15[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14 any] struct {
|
||||
_ HostLayout
|
||||
F0 T0
|
||||
F1 T1
|
||||
F2 T2
|
||||
@@ -207,6 +221,7 @@ type Tuple15[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14 any
|
||||
//
|
||||
// [Component Model tuple]: https://component-model.bytecodealliance.org/design/wit.html#tuples
|
||||
type Tuple16[T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15 any] struct {
|
||||
_ HostLayout
|
||||
F0 T0
|
||||
F1 T1
|
||||
F2 T2
|
||||
|
||||
@@ -12,7 +12,18 @@ type Discriminant interface {
|
||||
// Variant represents a loosely-typed Component Model variant.
|
||||
// Shape and Align must be non-zero sized types. To create a variant with no associated
|
||||
// types, use an enum.
|
||||
type Variant[Tag Discriminant, Shape, Align any] struct{ variant[Tag, Shape, Align] }
|
||||
type Variant[Tag Discriminant, Shape, Align any] struct {
|
||||
_ HostLayout
|
||||
variant[Tag, Shape, Align]
|
||||
}
|
||||
|
||||
// AnyVariant is a type constraint for generic functions that accept any [Variant] type.
|
||||
type AnyVariant[Tag Discriminant, Shape, Align any] interface {
|
||||
~struct {
|
||||
_ HostLayout
|
||||
variant[Tag, Shape, Align]
|
||||
}
|
||||
}
|
||||
|
||||
// NewVariant returns a [Variant] with tag of type Disc, storage and GC shape of type Shape,
|
||||
// aligned to type Align, with a value of type T.
|
||||
@@ -26,7 +37,7 @@ func NewVariant[Tag Discriminant, Shape, Align any, T any](tag Tag, data T) Vari
|
||||
|
||||
// New returns a [Variant] with tag of type Disc, storage and GC shape of type Shape,
|
||||
// aligned to type Align, with a value of type T.
|
||||
func New[V ~struct{ variant[Tag, Shape, Align] }, Tag Discriminant, Shape, Align any, T any](tag Tag, data T) V {
|
||||
func New[V AnyVariant[Tag, Shape, Align], Tag Discriminant, Shape, Align any, T any](tag Tag, data T) V {
|
||||
validateVariant[Tag, Shape, Align, T]()
|
||||
var v variant[Tag, Shape, Align]
|
||||
v.tag = tag
|
||||
@@ -35,7 +46,7 @@ func New[V ~struct{ variant[Tag, Shape, Align] }, Tag Discriminant, Shape, Align
|
||||
}
|
||||
|
||||
// Case returns a non-nil *T if the [Variant] case is equal to tag, otherwise it returns nil.
|
||||
func Case[T any, V ~struct{ variant[Tag, Shape, Align] }, Tag Discriminant, Shape, Align any](v *V, tag Tag) *T {
|
||||
func Case[T any, V AnyVariant[Tag, Shape, Align], Tag Discriminant, Shape, Align any](v *V, tag Tag) *T {
|
||||
validateVariant[Tag, Shape, Align, T]()
|
||||
v2 := (*variant[Tag, Shape, Align])(unsafe.Pointer(v))
|
||||
if v2.tag == tag {
|
||||
@@ -47,6 +58,7 @@ func Case[T any, V ~struct{ variant[Tag, Shape, Align] }, Tag Discriminant, Shap
|
||||
// variant is the internal representation of a Component Model variant.
|
||||
// Shape and Align must be non-zero sized types.
|
||||
type variant[Tag Discriminant, Shape, Align any] struct {
|
||||
_ HostLayout
|
||||
tag Tag
|
||||
_ [0]Align
|
||||
data Shape // [unsafe.Sizeof(*(*Shape)(unsafe.Pointer(nil)))]byte
|
||||
|
||||
+2099
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,21 @@
|
||||
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
||||
|
||||
package environment
|
||||
|
||||
import (
|
||||
"internal/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])
|
||||
@@ -26,10 +26,6 @@ func GetEnvironment() (result cm.List[[2]string]) {
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:cli/environment@0.2.0 get-environment
|
||||
//go:noescape
|
||||
func wasmimport_GetEnvironment(result *cm.List[[2]string])
|
||||
|
||||
// GetArguments represents the imported function "get-arguments".
|
||||
//
|
||||
// Get the POSIX-style arguments to the program.
|
||||
@@ -42,10 +38,6 @@ func GetArguments() (result cm.List[string]) {
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:cli/environment@0.2.0 get-arguments
|
||||
//go:noescape
|
||||
func wasmimport_GetArguments(result *cm.List[string])
|
||||
|
||||
// InitialCWD represents the imported function "initial-cwd".
|
||||
//
|
||||
// Return a path that programs should use as their initial current working
|
||||
@@ -58,7 +50,3 @@ func InitialCWD() (result cm.Option[string]) {
|
||||
wasmimport_InitialCWD(&result)
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:cli/environment@0.2.0 initial-cwd
|
||||
//go:noescape
|
||||
func wasmimport_InitialCWD(result *cm.Option[string])
|
||||
|
||||
+9
@@ -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)
|
||||
@@ -19,7 +19,3 @@ func Exit(status cm.BoolResult) {
|
||||
wasmimport_Exit((uint32)(status0))
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:cli/exit@0.2.0 exit
|
||||
//go:noescape
|
||||
func wasmimport_Exit(status0 uint32)
|
||||
|
||||
Executable
+17
@@ -0,0 +1,17 @@
|
||||
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
||||
|
||||
package run
|
||||
|
||||
import (
|
||||
"internal/cm"
|
||||
)
|
||||
|
||||
// This file contains wasmimport and wasmexport declarations for "wasi:cli@0.2.0".
|
||||
|
||||
//go:wasmexport wasi:cli/run@0.2.0#run
|
||||
//export wasi:cli/run@0.2.0#run
|
||||
func wasmexport_Run() (result0 uint32) {
|
||||
result := Exports.Run()
|
||||
result0 = cm.BoolToU32(result)
|
||||
return
|
||||
}
|
||||
@@ -2,15 +2,3 @@
|
||||
|
||||
// Package run represents the exported interface "wasi:cli/run@0.2.0".
|
||||
package run
|
||||
|
||||
import (
|
||||
"internal/cm"
|
||||
)
|
||||
|
||||
//go:wasmexport wasi:cli/run@0.2.0#run
|
||||
//export wasi:cli/run@0.2.0#run
|
||||
func wasmexport_Run() (result0 uint32) {
|
||||
result := Exports.Run()
|
||||
result0 = cm.BoolToU32(result)
|
||||
return
|
||||
}
|
||||
|
||||
+9
@@ -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)
|
||||
@@ -8,17 +8,18 @@ import (
|
||||
"internal/wasi/io/v0.2.0/streams"
|
||||
)
|
||||
|
||||
// OutputStream represents the imported type alias "wasi:cli/stderr@0.2.0#output-stream".
|
||||
//
|
||||
// See [streams.OutputStream] for more information.
|
||||
type OutputStream = streams.OutputStream
|
||||
|
||||
// GetStderr represents the imported function "get-stderr".
|
||||
//
|
||||
// get-stderr: func() -> output-stream
|
||||
//
|
||||
//go:nosplit
|
||||
func GetStderr() (result streams.OutputStream) {
|
||||
func GetStderr() (result OutputStream) {
|
||||
result0 := wasmimport_GetStderr()
|
||||
result = cm.Reinterpret[streams.OutputStream]((uint32)(result0))
|
||||
result = cm.Reinterpret[OutputStream]((uint32)(result0))
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:cli/stderr@0.2.0 get-stderr
|
||||
//go:noescape
|
||||
func wasmimport_GetStderr() (result0 uint32)
|
||||
|
||||
+9
@@ -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)
|
||||
@@ -8,17 +8,18 @@ import (
|
||||
"internal/wasi/io/v0.2.0/streams"
|
||||
)
|
||||
|
||||
// InputStream represents the imported type alias "wasi:cli/stdin@0.2.0#input-stream".
|
||||
//
|
||||
// See [streams.InputStream] for more information.
|
||||
type InputStream = streams.InputStream
|
||||
|
||||
// GetStdin represents the imported function "get-stdin".
|
||||
//
|
||||
// get-stdin: func() -> input-stream
|
||||
//
|
||||
//go:nosplit
|
||||
func GetStdin() (result streams.InputStream) {
|
||||
func GetStdin() (result InputStream) {
|
||||
result0 := wasmimport_GetStdin()
|
||||
result = cm.Reinterpret[streams.InputStream]((uint32)(result0))
|
||||
result = cm.Reinterpret[InputStream]((uint32)(result0))
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:cli/stdin@0.2.0 get-stdin
|
||||
//go:noescape
|
||||
func wasmimport_GetStdin() (result0 uint32)
|
||||
|
||||
+9
@@ -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)
|
||||
@@ -8,17 +8,18 @@ import (
|
||||
"internal/wasi/io/v0.2.0/streams"
|
||||
)
|
||||
|
||||
// OutputStream represents the imported type alias "wasi:cli/stdout@0.2.0#output-stream".
|
||||
//
|
||||
// See [streams.OutputStream] for more information.
|
||||
type OutputStream = streams.OutputStream
|
||||
|
||||
// GetStdout represents the imported function "get-stdout".
|
||||
//
|
||||
// get-stdout: func() -> output-stream
|
||||
//
|
||||
//go:nosplit
|
||||
func GetStdout() (result streams.OutputStream) {
|
||||
func GetStdout() (result OutputStream) {
|
||||
result0 := wasmimport_GetStdout()
|
||||
result = cm.Reinterpret[streams.OutputStream]((uint32)(result0))
|
||||
result = cm.Reinterpret[OutputStream]((uint32)(result0))
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:cli/stdout@0.2.0 get-stdout
|
||||
//go:noescape
|
||||
func wasmimport_GetStdout() (result0 uint32)
|
||||
|
||||
@@ -30,7 +30,3 @@ func (self TerminalInput) ResourceDrop() {
|
||||
wasmimport_TerminalInputResourceDrop((uint32)(self0))
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:cli/terminal-input@0.2.0 [resource-drop]terminal-input
|
||||
//go:noescape
|
||||
func wasmimport_TerminalInputResourceDrop(self0 uint32)
|
||||
|
||||
@@ -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)
|
||||
@@ -30,7 +30,3 @@ func (self TerminalOutput) ResourceDrop() {
|
||||
wasmimport_TerminalOutputResourceDrop((uint32)(self0))
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:cli/terminal-output@0.2.0 [resource-drop]terminal-output
|
||||
//go:noescape
|
||||
func wasmimport_TerminalOutputResourceDrop(self0 uint32)
|
||||
|
||||
@@ -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)
|
||||
@@ -11,6 +11,11 @@ import (
|
||||
terminaloutput "internal/wasi/cli/v0.2.0/terminal-output"
|
||||
)
|
||||
|
||||
// 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".
|
||||
//
|
||||
// If stderr is connected to a terminal, return a `terminal-output` handle
|
||||
@@ -19,11 +24,7 @@ import (
|
||||
// get-terminal-stderr: func() -> option<terminal-output>
|
||||
//
|
||||
//go:nosplit
|
||||
func GetTerminalStderr() (result cm.Option[terminaloutput.TerminalOutput]) {
|
||||
func GetTerminalStderr() (result cm.Option[TerminalOutput]) {
|
||||
wasmimport_GetTerminalStderr(&result)
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:cli/terminal-stderr@0.2.0 get-terminal-stderr
|
||||
//go:noescape
|
||||
func wasmimport_GetTerminalStderr(result *cm.Option[terminaloutput.TerminalOutput])
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
||||
|
||||
package terminalstderr
|
||||
|
||||
import (
|
||||
"internal/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])
|
||||
@@ -11,6 +11,11 @@ import (
|
||||
terminalinput "internal/wasi/cli/v0.2.0/terminal-input"
|
||||
)
|
||||
|
||||
// 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".
|
||||
//
|
||||
// If stdin is connected to a terminal, return a `terminal-input` handle
|
||||
@@ -19,11 +24,7 @@ import (
|
||||
// get-terminal-stdin: func() -> option<terminal-input>
|
||||
//
|
||||
//go:nosplit
|
||||
func GetTerminalStdin() (result cm.Option[terminalinput.TerminalInput]) {
|
||||
func GetTerminalStdin() (result cm.Option[TerminalInput]) {
|
||||
wasmimport_GetTerminalStdin(&result)
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:cli/terminal-stdin@0.2.0 get-terminal-stdin
|
||||
//go:noescape
|
||||
func wasmimport_GetTerminalStdin(result *cm.Option[terminalinput.TerminalInput])
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
||||
|
||||
package terminalstdin
|
||||
|
||||
import (
|
||||
"internal/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])
|
||||
@@ -11,6 +11,11 @@ import (
|
||||
terminaloutput "internal/wasi/cli/v0.2.0/terminal-output"
|
||||
)
|
||||
|
||||
// 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".
|
||||
//
|
||||
// If stdout is connected to a terminal, return a `terminal-output` handle
|
||||
@@ -19,11 +24,7 @@ import (
|
||||
// get-terminal-stdout: func() -> option<terminal-output>
|
||||
//
|
||||
//go:nosplit
|
||||
func GetTerminalStdout() (result cm.Option[terminaloutput.TerminalOutput]) {
|
||||
func GetTerminalStdout() (result cm.Option[TerminalOutput]) {
|
||||
wasmimport_GetTerminalStdout(&result)
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:cli/terminal-stdout@0.2.0 get-terminal-stdout
|
||||
//go:noescape
|
||||
func wasmimport_GetTerminalStdout(result *cm.Option[terminaloutput.TerminalOutput])
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
||||
|
||||
package terminalstdout
|
||||
|
||||
import (
|
||||
"internal/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])
|
||||
@@ -19,6 +19,11 @@ import (
|
||||
"internal/wasi/io/v0.2.0/poll"
|
||||
)
|
||||
|
||||
// Pollable represents the imported type alias "wasi:clocks/monotonic-clock@0.2.0#pollable".
|
||||
//
|
||||
// See [poll.Pollable] for more information.
|
||||
type Pollable = poll.Pollable
|
||||
|
||||
// Instant represents the u64 "wasi:clocks/monotonic-clock@0.2.0#instant".
|
||||
//
|
||||
// An instant in time, in nanoseconds. An instant is relative to an
|
||||
@@ -51,10 +56,6 @@ func Now() (result Instant) {
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:clocks/monotonic-clock@0.2.0 now
|
||||
//go:noescape
|
||||
func wasmimport_Now() (result0 uint64)
|
||||
|
||||
// Resolution represents the imported function "resolution".
|
||||
//
|
||||
// Query the resolution of the clock. Returns the duration of time
|
||||
@@ -69,10 +70,6 @@ func Resolution() (result Duration) {
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:clocks/monotonic-clock@0.2.0 resolution
|
||||
//go:noescape
|
||||
func wasmimport_Resolution() (result0 uint64)
|
||||
|
||||
// SubscribeInstant represents the imported function "subscribe-instant".
|
||||
//
|
||||
// Create a `pollable` which will resolve once the specified instant
|
||||
@@ -81,17 +78,13 @@ func wasmimport_Resolution() (result0 uint64)
|
||||
// subscribe-instant: func(when: instant) -> pollable
|
||||
//
|
||||
//go:nosplit
|
||||
func SubscribeInstant(when Instant) (result poll.Pollable) {
|
||||
func SubscribeInstant(when Instant) (result Pollable) {
|
||||
when0 := (uint64)(when)
|
||||
result0 := wasmimport_SubscribeInstant((uint64)(when0))
|
||||
result = cm.Reinterpret[poll.Pollable]((uint32)(result0))
|
||||
result = cm.Reinterpret[Pollable]((uint32)(result0))
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:clocks/monotonic-clock@0.2.0 subscribe-instant
|
||||
//go:noescape
|
||||
func wasmimport_SubscribeInstant(when0 uint64) (result0 uint32)
|
||||
|
||||
// SubscribeDuration represents the imported function "subscribe-duration".
|
||||
//
|
||||
// Create a `pollable` which will resolve once the given duration has
|
||||
@@ -101,13 +94,9 @@ func wasmimport_SubscribeInstant(when0 uint64) (result0 uint32)
|
||||
// subscribe-duration: func(when: duration) -> pollable
|
||||
//
|
||||
//go:nosplit
|
||||
func SubscribeDuration(when Duration) (result poll.Pollable) {
|
||||
func SubscribeDuration(when Duration) (result Pollable) {
|
||||
when0 := (uint64)(when)
|
||||
result0 := wasmimport_SubscribeDuration((uint64)(when0))
|
||||
result = cm.Reinterpret[poll.Pollable]((uint32)(result0))
|
||||
result = cm.Reinterpret[Pollable]((uint32)(result0))
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:clocks/monotonic-clock@0.2.0 subscribe-duration
|
||||
//go:noescape
|
||||
func wasmimport_SubscribeDuration(when0 uint64) (result0 uint32)
|
||||
|
||||
@@ -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)
|
||||
@@ -18,6 +18,10 @@
|
||||
// It is intended for reporting the current date and time for humans.
|
||||
package wallclock
|
||||
|
||||
import (
|
||||
"internal/cm"
|
||||
)
|
||||
|
||||
// DateTime represents the record "wasi:clocks/wall-clock@0.2.0#datetime".
|
||||
//
|
||||
// A time and date in seconds plus nanoseconds.
|
||||
@@ -27,6 +31,7 @@ package wallclock
|
||||
// nanoseconds: u32,
|
||||
// }
|
||||
type DateTime struct {
|
||||
_ cm.HostLayout
|
||||
Seconds uint64
|
||||
Nanoseconds uint32
|
||||
}
|
||||
@@ -55,10 +60,6 @@ func Now() (result DateTime) {
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:clocks/wall-clock@0.2.0 now
|
||||
//go:noescape
|
||||
func wasmimport_Now(result *DateTime)
|
||||
|
||||
// Resolution represents the imported function "resolution".
|
||||
//
|
||||
// Query the resolution of the clock.
|
||||
@@ -72,7 +73,3 @@ func Resolution() (result DateTime) {
|
||||
wasmimport_Resolution(&result)
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:clocks/wall-clock@0.2.0 resolution
|
||||
//go:noescape
|
||||
func wasmimport_Resolution(result *DateTime)
|
||||
|
||||
@@ -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)
|
||||
@@ -0,0 +1,13 @@
|
||||
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
||||
|
||||
package preopens
|
||||
|
||||
import (
|
||||
"internal/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]])
|
||||
@@ -8,6 +8,11 @@ import (
|
||||
"internal/wasi/filesystem/v0.2.0/types"
|
||||
)
|
||||
|
||||
// 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".
|
||||
//
|
||||
// Return the set of preopened directories, and their path.
|
||||
@@ -15,11 +20,7 @@ import (
|
||||
// get-directories: func() -> list<tuple<descriptor, string>>
|
||||
//
|
||||
//go:nosplit
|
||||
func GetDirectories() (result cm.List[cm.Tuple[types.Descriptor, string]]) {
|
||||
func GetDirectories() (result cm.List[cm.Tuple[Descriptor, string]]) {
|
||||
wasmimport_GetDirectories(&result)
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:filesystem/preopens@0.2.0 get-directories
|
||||
//go:noescape
|
||||
func wasmimport_GetDirectories(result *cm.List[cm.Tuple[types.Descriptor, string]])
|
||||
|
||||
@@ -8,18 +8,15 @@ import (
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// DateTimeShape is used for storage in variant or result types.
|
||||
type DateTimeShape struct {
|
||||
shape [unsafe.Sizeof(wallclock.DateTime{})]byte
|
||||
}
|
||||
|
||||
// MetadataHashValueShape is used for storage in variant or result types.
|
||||
type MetadataHashValueShape struct {
|
||||
_ 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
|
||||
}
|
||||
|
||||
@@ -42,10 +39,12 @@ func lower_NewTimestamp(v NewTimestamp) (f0 uint32, f1 uint64, f2 uint32) {
|
||||
|
||||
// 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
|
||||
}
|
||||
|
||||
+133
@@ -0,0 +1,133 @@
|
||||
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
||||
|
||||
package types
|
||||
|
||||
import (
|
||||
"internal/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])
|
||||
@@ -31,10 +31,29 @@ package types
|
||||
import (
|
||||
"internal/cm"
|
||||
wallclock "internal/wasi/clocks/v0.2.0/wall-clock"
|
||||
ioerror "internal/wasi/io/v0.2.0/error"
|
||||
"internal/wasi/io/v0.2.0/streams"
|
||||
)
|
||||
|
||||
// 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".
|
||||
//
|
||||
// File size or length of a region within a file.
|
||||
@@ -227,6 +246,7 @@ type LinkCount uint64
|
||||
// status-change-timestamp: option<datetime>,
|
||||
// }
|
||||
type DescriptorStat struct {
|
||||
_ cm.HostLayout
|
||||
// File type.
|
||||
Type DescriptorType
|
||||
|
||||
@@ -241,19 +261,19 @@ type DescriptorStat struct {
|
||||
//
|
||||
// If the `option` is none, the platform doesn't maintain an access
|
||||
// timestamp for this file.
|
||||
DataAccessTimestamp cm.Option[wallclock.DateTime]
|
||||
DataAccessTimestamp cm.Option[DateTime]
|
||||
|
||||
// Last data modification timestamp.
|
||||
//
|
||||
// If the `option` is none, the platform doesn't maintain a
|
||||
// modification timestamp for this file.
|
||||
DataModificationTimestamp cm.Option[wallclock.DateTime]
|
||||
DataModificationTimestamp cm.Option[DateTime]
|
||||
|
||||
// Last file status-change timestamp.
|
||||
//
|
||||
// If the `option` is none, the platform doesn't maintain a
|
||||
// status-change timestamp for this file.
|
||||
StatusChangeTimestamp cm.Option[wallclock.DateTime]
|
||||
StatusChangeTimestamp cm.Option[DateTime]
|
||||
}
|
||||
|
||||
// NewTimestamp represents the variant "wasi:filesystem/types@0.2.0#new-timestamp".
|
||||
@@ -265,7 +285,7 @@ type DescriptorStat struct {
|
||||
// now,
|
||||
// timestamp(datetime),
|
||||
// }
|
||||
type NewTimestamp cm.Variant[uint8, wallclock.DateTime, wallclock.DateTime]
|
||||
type NewTimestamp cm.Variant[uint8, DateTime, DateTime]
|
||||
|
||||
// NewTimestampNoChange returns a [NewTimestamp] of case "no-change".
|
||||
//
|
||||
@@ -297,13 +317,24 @@ func (self *NewTimestamp) Now() bool {
|
||||
// NewTimestampTimestamp returns a [NewTimestamp] of case "timestamp".
|
||||
//
|
||||
// Set the timestamp to the given value.
|
||||
func NewTimestampTimestamp(data wallclock.DateTime) NewTimestamp {
|
||||
func NewTimestampTimestamp(data DateTime) NewTimestamp {
|
||||
return cm.New[NewTimestamp](2, data)
|
||||
}
|
||||
|
||||
// Timestamp returns a non-nil *[wallclock.DateTime] if [NewTimestamp] represents the variant case "timestamp".
|
||||
func (self *NewTimestamp) Timestamp() *wallclock.DateTime {
|
||||
return cm.Case[wallclock.DateTime](self, 2)
|
||||
// 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".
|
||||
@@ -315,6 +346,7 @@ func (self *NewTimestamp) Timestamp() *wallclock.DateTime {
|
||||
// name: string,
|
||||
// }
|
||||
type DirectoryEntry struct {
|
||||
_ cm.HostLayout
|
||||
// The type of the file referred to by this directory entry.
|
||||
Type DescriptorType
|
||||
|
||||
@@ -593,6 +625,7 @@ func (e Advice) String() string {
|
||||
// upper: u64,
|
||||
// }
|
||||
type MetadataHashValue struct {
|
||||
_ cm.HostLayout
|
||||
// 64 bits of a 128-bit hash value.
|
||||
Lower uint64
|
||||
|
||||
@@ -620,10 +653,6 @@ func (self Descriptor) ResourceDrop() {
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:filesystem/types@0.2.0 [resource-drop]descriptor
|
||||
//go:noescape
|
||||
func wasmimport_DescriptorResourceDrop(self0 uint32)
|
||||
|
||||
// Advise represents the imported method "advise".
|
||||
//
|
||||
// Provide file advisory information on a descriptor.
|
||||
@@ -642,10 +671,6 @@ func (self Descriptor) Advise(offset FileSize, length FileSize, advice Advice) (
|
||||
return
|
||||
}
|
||||
|
||||
//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])
|
||||
|
||||
// AppendViaStream represents the imported method "append-via-stream".
|
||||
//
|
||||
// Return a stream for appending to a file, if available.
|
||||
@@ -658,16 +683,12 @@ func wasmimport_DescriptorAdvise(self0 uint32, offset0 uint64, length0 uint64, a
|
||||
// append-via-stream: func() -> result<output-stream, error-code>
|
||||
//
|
||||
//go:nosplit
|
||||
func (self Descriptor) AppendViaStream() (result cm.Result[streams.OutputStream, streams.OutputStream, ErrorCode]) {
|
||||
func (self Descriptor) AppendViaStream() (result cm.Result[OutputStream, OutputStream, ErrorCode]) {
|
||||
self0 := cm.Reinterpret[uint32](self)
|
||||
wasmimport_DescriptorAppendViaStream((uint32)(self0), &result)
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:filesystem/types@0.2.0 [method]descriptor.append-via-stream
|
||||
//go:noescape
|
||||
func wasmimport_DescriptorAppendViaStream(self0 uint32, result *cm.Result[streams.OutputStream, streams.OutputStream, ErrorCode])
|
||||
|
||||
// CreateDirectoryAt represents the imported method "create-directory-at".
|
||||
//
|
||||
// Create a directory.
|
||||
@@ -684,10 +705,6 @@ func (self Descriptor) CreateDirectoryAt(path string) (result cm.Result[ErrorCod
|
||||
return
|
||||
}
|
||||
|
||||
//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])
|
||||
|
||||
// GetFlags represents the imported method "get-flags".
|
||||
//
|
||||
// Get flags associated with a descriptor.
|
||||
@@ -706,10 +723,6 @@ func (self Descriptor) GetFlags() (result cm.Result[DescriptorFlags, DescriptorF
|
||||
return
|
||||
}
|
||||
|
||||
//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])
|
||||
|
||||
// GetType represents the imported method "get-type".
|
||||
//
|
||||
// Get the dynamic type of a descriptor.
|
||||
@@ -732,10 +745,6 @@ func (self Descriptor) GetType() (result cm.Result[DescriptorType, DescriptorTyp
|
||||
return
|
||||
}
|
||||
|
||||
//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])
|
||||
|
||||
// IsSameObject represents the imported method "is-same-object".
|
||||
//
|
||||
// Test whether two descriptors refer to the same filesystem object.
|
||||
@@ -756,10 +765,6 @@ func (self Descriptor) IsSameObject(other Descriptor) (result bool) {
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:filesystem/types@0.2.0 [method]descriptor.is-same-object
|
||||
//go:noescape
|
||||
func wasmimport_DescriptorIsSameObject(self0 uint32, other0 uint32) (result0 uint32)
|
||||
|
||||
// LinkAt represents the imported method "link-at".
|
||||
//
|
||||
// Create a hard link.
|
||||
@@ -780,10 +785,6 @@ func (self Descriptor) LinkAt(oldPathFlags PathFlags, oldPath string, newDescrip
|
||||
return
|
||||
}
|
||||
|
||||
//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])
|
||||
|
||||
// MetadataHash represents the imported method "metadata-hash".
|
||||
//
|
||||
// Return a hash of the metadata associated with a filesystem object referred
|
||||
@@ -815,10 +816,6 @@ func (self Descriptor) MetadataHash() (result cm.Result[MetadataHashValueShape,
|
||||
return
|
||||
}
|
||||
|
||||
//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])
|
||||
|
||||
// MetadataHashAt represents the imported method "metadata-hash-at".
|
||||
//
|
||||
// Return a hash of the metadata associated with a filesystem object referred
|
||||
@@ -838,10 +835,6 @@ func (self Descriptor) MetadataHashAt(pathFlags PathFlags, path string) (result
|
||||
return
|
||||
}
|
||||
|
||||
//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])
|
||||
|
||||
// OpenAt represents the imported method "open-at".
|
||||
//
|
||||
// Open a file or directory.
|
||||
@@ -877,10 +870,6 @@ func (self Descriptor) OpenAt(pathFlags PathFlags, path string, openFlags OpenFl
|
||||
return
|
||||
}
|
||||
|
||||
//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])
|
||||
|
||||
// Read represents the imported method "read".
|
||||
//
|
||||
// Read from a descriptor, without using and updating the descriptor's offset.
|
||||
@@ -907,10 +896,6 @@ func (self Descriptor) Read(length FileSize, offset FileSize) (result cm.Result[
|
||||
return
|
||||
}
|
||||
|
||||
//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])
|
||||
|
||||
// ReadDirectory represents the imported method "read-directory".
|
||||
//
|
||||
// Read directory entries from a directory.
|
||||
@@ -932,10 +917,6 @@ func (self Descriptor) ReadDirectory() (result cm.Result[DirectoryEntryStream, D
|
||||
return
|
||||
}
|
||||
|
||||
//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])
|
||||
|
||||
// ReadViaStream represents the imported method "read-via-stream".
|
||||
//
|
||||
// Return a stream for reading from a file, if available.
|
||||
@@ -950,17 +931,13 @@ func wasmimport_DescriptorReadDirectory(self0 uint32, result *cm.Result[Director
|
||||
// read-via-stream: func(offset: filesize) -> result<input-stream, error-code>
|
||||
//
|
||||
//go:nosplit
|
||||
func (self Descriptor) ReadViaStream(offset FileSize) (result cm.Result[streams.InputStream, streams.InputStream, ErrorCode]) {
|
||||
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
|
||||
}
|
||||
|
||||
//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[streams.InputStream, streams.InputStream, ErrorCode])
|
||||
|
||||
// ReadLinkAt represents the imported method "readlink-at".
|
||||
//
|
||||
// Read the contents of a symbolic link.
|
||||
@@ -980,10 +957,6 @@ func (self Descriptor) ReadLinkAt(path string) (result cm.Result[string, string,
|
||||
return
|
||||
}
|
||||
|
||||
//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])
|
||||
|
||||
// RemoveDirectoryAt represents the imported method "remove-directory-at".
|
||||
//
|
||||
// Remove a directory.
|
||||
@@ -1002,10 +975,6 @@ func (self Descriptor) RemoveDirectoryAt(path string) (result cm.Result[ErrorCod
|
||||
return
|
||||
}
|
||||
|
||||
//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])
|
||||
|
||||
// RenameAt represents the imported method "rename-at".
|
||||
//
|
||||
// Rename a filesystem object.
|
||||
@@ -1025,10 +994,6 @@ func (self Descriptor) RenameAt(oldPath string, newDescriptor Descriptor, newPat
|
||||
return
|
||||
}
|
||||
|
||||
//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])
|
||||
|
||||
// SetSize represents the imported method "set-size".
|
||||
//
|
||||
// Adjust the size of an open file. If this increases the file's size, the
|
||||
@@ -1046,10 +1011,6 @@ func (self Descriptor) SetSize(size FileSize) (result cm.Result[ErrorCode, struc
|
||||
return
|
||||
}
|
||||
|
||||
//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])
|
||||
|
||||
// SetTimes represents the imported method "set-times".
|
||||
//
|
||||
// Adjust the timestamps of an open file or directory.
|
||||
@@ -1070,10 +1031,6 @@ func (self Descriptor) SetTimes(dataAccessTimestamp NewTimestamp, dataModificati
|
||||
return
|
||||
}
|
||||
|
||||
//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])
|
||||
|
||||
// SetTimesAt represents the imported method "set-times-at".
|
||||
//
|
||||
// Adjust the timestamps of a file or directory.
|
||||
@@ -1097,10 +1054,6 @@ func (self Descriptor) SetTimesAt(pathFlags PathFlags, path string, dataAccessTi
|
||||
return
|
||||
}
|
||||
|
||||
//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])
|
||||
|
||||
// Stat represents the imported method "stat".
|
||||
//
|
||||
// Return the attributes of an open file or directory.
|
||||
@@ -1122,10 +1075,6 @@ func (self Descriptor) Stat() (result cm.Result[DescriptorStatShape, DescriptorS
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:filesystem/types@0.2.0 [method]descriptor.stat
|
||||
//go:noescape
|
||||
func wasmimport_DescriptorStat(self0 uint32, result *cm.Result[DescriptorStatShape, DescriptorStat, ErrorCode])
|
||||
|
||||
// StatAt represents the imported method "stat-at".
|
||||
//
|
||||
// Return the attributes of a file or directory.
|
||||
@@ -1148,10 +1097,6 @@ func (self Descriptor) StatAt(pathFlags PathFlags, path string) (result cm.Resul
|
||||
return
|
||||
}
|
||||
|
||||
//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])
|
||||
|
||||
// SymlinkAt represents the imported method "symlink-at".
|
||||
//
|
||||
// Create a symbolic link (also known as a "symlink").
|
||||
@@ -1172,10 +1117,6 @@ func (self Descriptor) SymlinkAt(oldPath string, newPath string) (result cm.Resu
|
||||
return
|
||||
}
|
||||
|
||||
//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])
|
||||
|
||||
// Sync represents the imported method "sync".
|
||||
//
|
||||
// Synchronize the data and metadata of a file to disk.
|
||||
@@ -1194,10 +1135,6 @@ func (self Descriptor) Sync() (result cm.Result[ErrorCode, struct{}, ErrorCode])
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:filesystem/types@0.2.0 [method]descriptor.sync
|
||||
//go:noescape
|
||||
func wasmimport_DescriptorSync(self0 uint32, result *cm.Result[ErrorCode, struct{}, ErrorCode])
|
||||
|
||||
// SyncData represents the imported method "sync-data".
|
||||
//
|
||||
// Synchronize the data of a file to disk.
|
||||
@@ -1216,10 +1153,6 @@ func (self Descriptor) SyncData() (result cm.Result[ErrorCode, struct{}, ErrorCo
|
||||
return
|
||||
}
|
||||
|
||||
//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])
|
||||
|
||||
// UnlinkFileAt represents the imported method "unlink-file-at".
|
||||
//
|
||||
// Unlink a filesystem object that is not a directory.
|
||||
@@ -1237,10 +1170,6 @@ func (self Descriptor) UnlinkFileAt(path string) (result cm.Result[ErrorCode, st
|
||||
return
|
||||
}
|
||||
|
||||
//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])
|
||||
|
||||
// Write represents the imported method "write".
|
||||
//
|
||||
// Write to a descriptor, without using and updating the descriptor's offset.
|
||||
@@ -1264,10 +1193,6 @@ func (self Descriptor) Write(buffer cm.List[uint8], offset FileSize) (result cm.
|
||||
return
|
||||
}
|
||||
|
||||
//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])
|
||||
|
||||
// WriteViaStream represents the imported method "write-via-stream".
|
||||
//
|
||||
// Return a stream for writing to a file, if available.
|
||||
@@ -1280,17 +1205,13 @@ func wasmimport_DescriptorWrite(self0 uint32, buffer0 *uint8, buffer1 uint32, of
|
||||
// write-via-stream: func(offset: filesize) -> result<output-stream, error-code>
|
||||
//
|
||||
//go:nosplit
|
||||
func (self Descriptor) WriteViaStream(offset FileSize) (result cm.Result[streams.OutputStream, streams.OutputStream, ErrorCode]) {
|
||||
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
|
||||
}
|
||||
|
||||
//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[streams.OutputStream, streams.OutputStream, ErrorCode])
|
||||
|
||||
// DirectoryEntryStream represents the imported resource "wasi:filesystem/types@0.2.0#directory-entry-stream".
|
||||
//
|
||||
// A stream of directory entries.
|
||||
@@ -1309,10 +1230,6 @@ func (self DirectoryEntryStream) ResourceDrop() {
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:filesystem/types@0.2.0 [resource-drop]directory-entry-stream
|
||||
//go:noescape
|
||||
func wasmimport_DirectoryEntryStreamResourceDrop(self0 uint32)
|
||||
|
||||
// ReadDirectoryEntry represents the imported method "read-directory-entry".
|
||||
//
|
||||
// Read a single directory entry from a `directory-entry-stream`.
|
||||
@@ -1326,10 +1243,6 @@ func (self DirectoryEntryStream) ReadDirectoryEntry() (result cm.Result[OptionDi
|
||||
return
|
||||
}
|
||||
|
||||
//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])
|
||||
|
||||
// FilesystemErrorCode represents the imported function "filesystem-error-code".
|
||||
//
|
||||
// Attempts to extract a filesystem-related `error-code` from the stream
|
||||
@@ -1346,12 +1259,8 @@ func wasmimport_DirectoryEntryStreamReadDirectoryEntry(self0 uint32, result *cm.
|
||||
// filesystem-error-code: func(err: borrow<error>) -> option<error-code>
|
||||
//
|
||||
//go:nosplit
|
||||
func FilesystemErrorCode(err ioerror.Error) (result cm.Option[ErrorCode]) {
|
||||
func FilesystemErrorCode(err Error) (result cm.Option[ErrorCode]) {
|
||||
err0 := cm.Reinterpret[uint32](err)
|
||||
wasmimport_FilesystemErrorCode((uint32)(err0), &result)
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:filesystem/types@0.2.0 filesystem-error-code
|
||||
//go:noescape
|
||||
func wasmimport_FilesystemErrorCode(err0 uint32, result *cm.Option[ErrorCode])
|
||||
|
||||
@@ -43,10 +43,6 @@ func (self Error) ResourceDrop() {
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:io/error@0.2.0 [resource-drop]error
|
||||
//go:noescape
|
||||
func wasmimport_ErrorResourceDrop(self0 uint32)
|
||||
|
||||
// ToDebugString represents the imported method "to-debug-string".
|
||||
//
|
||||
// Returns a string that is suitable to assist humans in debugging
|
||||
@@ -65,7 +61,3 @@ func (self Error) ToDebugString() (result string) {
|
||||
wasmimport_ErrorToDebugString((uint32)(self0), &result)
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:io/error@0.2.0 [method]error.to-debug-string
|
||||
//go:noescape
|
||||
func wasmimport_ErrorToDebugString(self0 uint32, result *string)
|
||||
|
||||
+13
@@ -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)
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
||||
|
||||
package poll
|
||||
|
||||
import (
|
||||
"internal/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])
|
||||
@@ -28,10 +28,6 @@ func (self Pollable) ResourceDrop() {
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:io/poll@0.2.0 [resource-drop]pollable
|
||||
//go:noescape
|
||||
func wasmimport_PollableResourceDrop(self0 uint32)
|
||||
|
||||
// Block represents the imported method "block".
|
||||
//
|
||||
// `block` returns immediately if the pollable is ready, and otherwise
|
||||
@@ -49,10 +45,6 @@ func (self Pollable) Block() {
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:io/poll@0.2.0 [method]pollable.block
|
||||
//go:noescape
|
||||
func wasmimport_PollableBlock(self0 uint32)
|
||||
|
||||
// Ready represents the imported method "ready".
|
||||
//
|
||||
// Return the readiness of a pollable. This function never blocks.
|
||||
@@ -69,10 +61,6 @@ func (self Pollable) Ready() (result bool) {
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:io/poll@0.2.0 [method]pollable.ready
|
||||
//go:noescape
|
||||
func wasmimport_PollableReady(self0 uint32) (result0 uint32)
|
||||
|
||||
// Poll represents the imported function "poll".
|
||||
//
|
||||
// Poll for completion on a set of pollables.
|
||||
@@ -102,7 +90,3 @@ func Poll(in cm.List[Pollable]) (result cm.List[uint32]) {
|
||||
wasmimport_Poll((*Pollable)(in0), (uint32)(in1), &result)
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:io/poll@0.2.0 poll
|
||||
//go:noescape
|
||||
func wasmimport_Poll(in0 *Pollable, in1 uint32, result *cm.List[uint32])
|
||||
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
||||
|
||||
package streams
|
||||
|
||||
import (
|
||||
"internal/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])
|
||||
@@ -15,6 +15,16 @@ import (
|
||||
"internal/wasi/io/v0.2.0/poll"
|
||||
)
|
||||
|
||||
// Error represents the imported type alias "wasi:io/streams@0.2.0#error".
|
||||
//
|
||||
// See [ioerror.Error] for more information.
|
||||
type Error = ioerror.Error
|
||||
|
||||
// Pollable represents the imported type alias "wasi:io/streams@0.2.0#pollable".
|
||||
//
|
||||
// See [poll.Pollable] for more information.
|
||||
type Pollable = poll.Pollable
|
||||
|
||||
// StreamError represents the imported variant "wasi:io/streams@0.2.0#stream-error".
|
||||
//
|
||||
// An error for input-stream and output-stream operations.
|
||||
@@ -23,20 +33,20 @@ import (
|
||||
// last-operation-failed(error),
|
||||
// closed,
|
||||
// }
|
||||
type StreamError cm.Variant[uint8, ioerror.Error, ioerror.Error]
|
||||
type StreamError cm.Variant[uint8, Error, Error]
|
||||
|
||||
// StreamErrorLastOperationFailed returns a [StreamError] of case "last-operation-failed".
|
||||
//
|
||||
// The last operation (a write or flush) failed before completion.
|
||||
//
|
||||
// More information is available in the `error` payload.
|
||||
func StreamErrorLastOperationFailed(data ioerror.Error) StreamError {
|
||||
func StreamErrorLastOperationFailed(data Error) StreamError {
|
||||
return cm.New[StreamError](0, data)
|
||||
}
|
||||
|
||||
// LastOperationFailed returns a non-nil *[ioerror.Error] if [StreamError] represents the variant case "last-operation-failed".
|
||||
func (self *StreamError) LastOperationFailed() *ioerror.Error {
|
||||
return cm.Case[ioerror.Error](self, 0)
|
||||
// LastOperationFailed returns a non-nil *[Error] if [StreamError] represents the variant case "last-operation-failed".
|
||||
func (self *StreamError) LastOperationFailed() *Error {
|
||||
return cm.Case[Error](self, 0)
|
||||
}
|
||||
|
||||
// StreamErrorClosed returns a [StreamError] of case "closed".
|
||||
@@ -54,6 +64,16 @@ func (self *StreamError) Closed() bool {
|
||||
return self.Tag() == 1
|
||||
}
|
||||
|
||||
var 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".
|
||||
//
|
||||
// An input bytestream.
|
||||
@@ -79,10 +99,6 @@ func (self InputStream) ResourceDrop() {
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:io/streams@0.2.0 [resource-drop]input-stream
|
||||
//go:noescape
|
||||
func wasmimport_InputStreamResourceDrop(self0 uint32)
|
||||
|
||||
// BlockingRead represents the imported method "blocking-read".
|
||||
//
|
||||
// Read bytes from a stream, after blocking until at least one byte can
|
||||
@@ -98,10 +114,6 @@ func (self InputStream) BlockingRead(len_ uint64) (result cm.Result[cm.List[uint
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:io/streams@0.2.0 [method]input-stream.blocking-read
|
||||
//go:noescape
|
||||
func wasmimport_InputStreamBlockingRead(self0 uint32, len0 uint64, result *cm.Result[cm.List[uint8], cm.List[uint8], StreamError])
|
||||
|
||||
// BlockingSkip represents the imported method "blocking-skip".
|
||||
//
|
||||
// Skip bytes from a stream, after blocking until at least one byte
|
||||
@@ -117,10 +129,6 @@ func (self InputStream) BlockingSkip(len_ uint64) (result cm.Result[uint64, uint
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:io/streams@0.2.0 [method]input-stream.blocking-skip
|
||||
//go:noescape
|
||||
func wasmimport_InputStreamBlockingSkip(self0 uint32, len0 uint64, result *cm.Result[uint64, uint64, StreamError])
|
||||
|
||||
// Read represents the imported method "read".
|
||||
//
|
||||
// Perform a non-blocking read from the stream.
|
||||
@@ -160,10 +168,6 @@ func (self InputStream) Read(len_ uint64) (result cm.Result[cm.List[uint8], cm.L
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:io/streams@0.2.0 [method]input-stream.read
|
||||
//go:noescape
|
||||
func wasmimport_InputStreamRead(self0 uint32, len0 uint64, result *cm.Result[cm.List[uint8], cm.List[uint8], StreamError])
|
||||
|
||||
// Skip represents the imported method "skip".
|
||||
//
|
||||
// Skip bytes from a stream. Returns number of bytes skipped.
|
||||
@@ -181,10 +185,6 @@ func (self InputStream) Skip(len_ uint64) (result cm.Result[uint64, uint64, Stre
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:io/streams@0.2.0 [method]input-stream.skip
|
||||
//go:noescape
|
||||
func wasmimport_InputStreamSkip(self0 uint32, len0 uint64, result *cm.Result[uint64, uint64, StreamError])
|
||||
|
||||
// Subscribe represents the imported method "subscribe".
|
||||
//
|
||||
// Create a `pollable` which will resolve once either the specified stream
|
||||
@@ -197,17 +197,13 @@ func wasmimport_InputStreamSkip(self0 uint32, len0 uint64, result *cm.Result[uin
|
||||
// subscribe: func() -> pollable
|
||||
//
|
||||
//go:nosplit
|
||||
func (self InputStream) Subscribe() (result poll.Pollable) {
|
||||
func (self InputStream) Subscribe() (result Pollable) {
|
||||
self0 := cm.Reinterpret[uint32](self)
|
||||
result0 := wasmimport_InputStreamSubscribe((uint32)(self0))
|
||||
result = cm.Reinterpret[poll.Pollable]((uint32)(result0))
|
||||
result = cm.Reinterpret[Pollable]((uint32)(result0))
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:io/streams@0.2.0 [method]input-stream.subscribe
|
||||
//go:noescape
|
||||
func wasmimport_InputStreamSubscribe(self0 uint32) (result0 uint32)
|
||||
|
||||
// OutputStream represents the imported resource "wasi:io/streams@0.2.0#output-stream".
|
||||
//
|
||||
// An output bytestream.
|
||||
@@ -233,10 +229,6 @@ func (self OutputStream) ResourceDrop() {
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:io/streams@0.2.0 [resource-drop]output-stream
|
||||
//go:noescape
|
||||
func wasmimport_OutputStreamResourceDrop(self0 uint32)
|
||||
|
||||
// BlockingFlush represents the imported method "blocking-flush".
|
||||
//
|
||||
// Request to flush buffered output, and block until flush completes
|
||||
@@ -251,10 +243,6 @@ func (self OutputStream) BlockingFlush() (result cm.Result[StreamError, struct{}
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:io/streams@0.2.0 [method]output-stream.blocking-flush
|
||||
//go:noescape
|
||||
func wasmimport_OutputStreamBlockingFlush(self0 uint32, result *cm.Result[StreamError, struct{}, StreamError])
|
||||
|
||||
// BlockingSplice represents the imported method "blocking-splice".
|
||||
//
|
||||
// Read from one stream and write to another, with blocking.
|
||||
@@ -274,10 +262,6 @@ func (self OutputStream) BlockingSplice(src InputStream, len_ uint64) (result cm
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:io/streams@0.2.0 [method]output-stream.blocking-splice
|
||||
//go:noescape
|
||||
func wasmimport_OutputStreamBlockingSplice(self0 uint32, src0 uint32, len0 uint64, result *cm.Result[uint64, uint64, StreamError])
|
||||
|
||||
// BlockingWriteAndFlush represents the imported method "blocking-write-and-flush".
|
||||
//
|
||||
// Perform a write of up to 4096 bytes, and then flush the stream. Block
|
||||
@@ -313,10 +297,6 @@ func (self OutputStream) BlockingWriteAndFlush(contents cm.List[uint8]) (result
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:io/streams@0.2.0 [method]output-stream.blocking-write-and-flush
|
||||
//go:noescape
|
||||
func wasmimport_OutputStreamBlockingWriteAndFlush(self0 uint32, contents0 *uint8, contents1 uint32, result *cm.Result[StreamError, struct{}, StreamError])
|
||||
|
||||
// BlockingWriteZeroesAndFlush represents the imported method "blocking-write-zeroes-and-flush".
|
||||
//
|
||||
// Perform a write of up to 4096 zeroes, and then flush the stream.
|
||||
@@ -352,10 +332,6 @@ func (self OutputStream) BlockingWriteZeroesAndFlush(len_ uint64) (result cm.Res
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:io/streams@0.2.0 [method]output-stream.blocking-write-zeroes-and-flush
|
||||
//go:noescape
|
||||
func wasmimport_OutputStreamBlockingWriteZeroesAndFlush(self0 uint32, len0 uint64, result *cm.Result[StreamError, struct{}, StreamError])
|
||||
|
||||
// CheckWrite represents the imported method "check-write".
|
||||
//
|
||||
// Check readiness for writing. This function never blocks.
|
||||
@@ -377,10 +353,6 @@ func (self OutputStream) CheckWrite() (result cm.Result[uint64, uint64, StreamEr
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:io/streams@0.2.0 [method]output-stream.check-write
|
||||
//go:noescape
|
||||
func wasmimport_OutputStreamCheckWrite(self0 uint32, result *cm.Result[uint64, uint64, StreamError])
|
||||
|
||||
// Flush represents the imported method "flush".
|
||||
//
|
||||
// Request to flush buffered output. This function never blocks.
|
||||
@@ -403,10 +375,6 @@ func (self OutputStream) Flush() (result cm.Result[StreamError, struct{}, Stream
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:io/streams@0.2.0 [method]output-stream.flush
|
||||
//go:noescape
|
||||
func wasmimport_OutputStreamFlush(self0 uint32, result *cm.Result[StreamError, struct{}, StreamError])
|
||||
|
||||
// Splice represents the imported method "splice".
|
||||
//
|
||||
// Read from one stream and write to another.
|
||||
@@ -434,10 +402,6 @@ func (self OutputStream) Splice(src InputStream, len_ uint64) (result cm.Result[
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:io/streams@0.2.0 [method]output-stream.splice
|
||||
//go:noescape
|
||||
func wasmimport_OutputStreamSplice(self0 uint32, src0 uint32, len0 uint64, result *cm.Result[uint64, uint64, StreamError])
|
||||
|
||||
// Subscribe represents the imported method "subscribe".
|
||||
//
|
||||
// Create a `pollable` which will resolve once the output-stream
|
||||
@@ -454,17 +418,13 @@ func wasmimport_OutputStreamSplice(self0 uint32, src0 uint32, len0 uint64, resul
|
||||
// subscribe: func() -> pollable
|
||||
//
|
||||
//go:nosplit
|
||||
func (self OutputStream) Subscribe() (result poll.Pollable) {
|
||||
func (self OutputStream) Subscribe() (result Pollable) {
|
||||
self0 := cm.Reinterpret[uint32](self)
|
||||
result0 := wasmimport_OutputStreamSubscribe((uint32)(self0))
|
||||
result = cm.Reinterpret[poll.Pollable]((uint32)(result0))
|
||||
result = cm.Reinterpret[Pollable]((uint32)(result0))
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:io/streams@0.2.0 [method]output-stream.subscribe
|
||||
//go:noescape
|
||||
func wasmimport_OutputStreamSubscribe(self0 uint32) (result0 uint32)
|
||||
|
||||
// Write represents the imported method "write".
|
||||
//
|
||||
// Perform a write. This function never blocks.
|
||||
@@ -491,10 +451,6 @@ func (self OutputStream) Write(contents cm.List[uint8]) (result cm.Result[Stream
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:io/streams@0.2.0 [method]output-stream.write
|
||||
//go:noescape
|
||||
func wasmimport_OutputStreamWrite(self0 uint32, contents0 *uint8, contents1 uint32, result *cm.Result[StreamError, struct{}, StreamError])
|
||||
|
||||
// WriteZeroes represents the imported method "write-zeroes".
|
||||
//
|
||||
// Write zeroes to a stream.
|
||||
@@ -513,7 +469,3 @@ func (self OutputStream) WriteZeroes(len_ uint64) (result cm.Result[StreamError,
|
||||
wasmimport_OutputStreamWriteZeroes((uint32)(self0), (uint64)(len0), &result)
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:io/streams@0.2.0 [method]output-stream.write-zeroes
|
||||
//go:noescape
|
||||
func wasmimport_OutputStreamWriteZeroes(self0 uint32, len0 uint64, result *cm.Result[StreamError, struct{}, StreamError])
|
||||
|
||||
@@ -35,7 +35,3 @@ func InsecureSeed() (result [2]uint64) {
|
||||
wasmimport_InsecureSeed(&result)
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:random/insecure-seed@0.2.0 insecure-seed
|
||||
//go:noescape
|
||||
func wasmimport_InsecureSeed(result *[2]uint64)
|
||||
|
||||
@@ -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)
|
||||
@@ -0,0 +1,17 @@
|
||||
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
||||
|
||||
package insecure
|
||||
|
||||
import (
|
||||
"internal/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)
|
||||
@@ -32,10 +32,6 @@ func GetInsecureRandomBytes(len_ uint64) (result cm.List[uint8]) {
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:random/insecure@0.2.0 get-insecure-random-bytes
|
||||
//go:noescape
|
||||
func wasmimport_GetInsecureRandomBytes(len0 uint64, result *cm.List[uint8])
|
||||
|
||||
// GetInsecureRandomU64 represents the imported function "get-insecure-random-u64".
|
||||
//
|
||||
// Return an insecure pseudo-random `u64` value.
|
||||
@@ -51,7 +47,3 @@ func GetInsecureRandomU64() (result uint64) {
|
||||
result = (uint64)((uint64)(result0))
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:random/insecure@0.2.0 get-insecure-random-u64
|
||||
//go:noescape
|
||||
func wasmimport_GetInsecureRandomU64() (result0 uint64)
|
||||
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
||||
|
||||
package random
|
||||
|
||||
import (
|
||||
"internal/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)
|
||||
@@ -36,10 +36,6 @@ func GetRandomBytes(len_ uint64) (result cm.List[uint8]) {
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:random/random@0.2.0 get-random-bytes
|
||||
//go:noescape
|
||||
func wasmimport_GetRandomBytes(len0 uint64, result *cm.List[uint8])
|
||||
|
||||
// GetRandomU64 represents the imported function "get-random-u64".
|
||||
//
|
||||
// Return a cryptographically-secure random or pseudo-random `u64` value.
|
||||
@@ -55,7 +51,3 @@ func GetRandomU64() (result uint64) {
|
||||
result = (uint64)((uint64)(result0))
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:random/random@0.2.0 get-random-u64
|
||||
//go:noescape
|
||||
func wasmimport_GetRandomU64() (result0 uint64)
|
||||
|
||||
@@ -10,6 +10,11 @@ import (
|
||||
"internal/wasi/sockets/v0.2.0/network"
|
||||
)
|
||||
|
||||
// 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".
|
||||
//
|
||||
// Get a handle to the default network.
|
||||
@@ -17,12 +22,8 @@ import (
|
||||
// instance-network: func() -> network
|
||||
//
|
||||
//go:nosplit
|
||||
func InstanceNetwork() (result network.Network) {
|
||||
func InstanceNetwork() (result Network) {
|
||||
result0 := wasmimport_InstanceNetwork()
|
||||
result = cm.Reinterpret[network.Network]((uint32)(result0))
|
||||
result = cm.Reinterpret[Network]((uint32)(result0))
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:sockets/instance-network@0.2.0 instance-network
|
||||
//go:noescape
|
||||
func wasmimport_InstanceNetwork() (result0 uint32)
|
||||
|
||||
@@ -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)
|
||||
@@ -4,11 +4,11 @@ package ipnamelookup
|
||||
|
||||
import (
|
||||
"internal/cm"
|
||||
"internal/wasi/sockets/v0.2.0/network"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// OptionIPAddressShape is used for storage in variant or result types.
|
||||
type OptionIPAddressShape struct {
|
||||
shape [unsafe.Sizeof(cm.Option[network.IPAddress]{})]byte
|
||||
_ cm.HostLayout
|
||||
shape [unsafe.Sizeof(cm.Option[IPAddress]{})]byte
|
||||
}
|
||||
|
||||
@@ -9,6 +9,26 @@ import (
|
||||
"internal/wasi/sockets/v0.2.0/network"
|
||||
)
|
||||
|
||||
// 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
|
||||
@@ -25,10 +45,6 @@ func (self ResolveAddressStream) ResourceDrop() {
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:sockets/ip-name-lookup@0.2.0 [resource-drop]resolve-address-stream
|
||||
//go:noescape
|
||||
func wasmimport_ResolveAddressStreamResourceDrop(self0 uint32)
|
||||
|
||||
// ResolveNextAddress represents the imported method "resolve-next-address".
|
||||
//
|
||||
// Returns the next address from the resolver.
|
||||
@@ -51,16 +67,12 @@ func wasmimport_ResolveAddressStreamResourceDrop(self0 uint32)
|
||||
// resolve-next-address: func() -> result<option<ip-address>, error-code>
|
||||
//
|
||||
//go:nosplit
|
||||
func (self ResolveAddressStream) ResolveNextAddress() (result cm.Result[OptionIPAddressShape, cm.Option[network.IPAddress], network.ErrorCode]) {
|
||||
func (self ResolveAddressStream) ResolveNextAddress() (result cm.Result[OptionIPAddressShape, cm.Option[IPAddress], ErrorCode]) {
|
||||
self0 := cm.Reinterpret[uint32](self)
|
||||
wasmimport_ResolveAddressStreamResolveNextAddress((uint32)(self0), &result)
|
||||
return
|
||||
}
|
||||
|
||||
//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[network.IPAddress], network.ErrorCode])
|
||||
|
||||
// Subscribe represents the imported method "subscribe".
|
||||
//
|
||||
// Create a `pollable` which will resolve once the stream is ready for I/O.
|
||||
@@ -71,17 +83,13 @@ func wasmimport_ResolveAddressStreamResolveNextAddress(self0 uint32, result *cm.
|
||||
// subscribe: func() -> pollable
|
||||
//
|
||||
//go:nosplit
|
||||
func (self ResolveAddressStream) Subscribe() (result poll.Pollable) {
|
||||
func (self ResolveAddressStream) Subscribe() (result Pollable) {
|
||||
self0 := cm.Reinterpret[uint32](self)
|
||||
result0 := wasmimport_ResolveAddressStreamSubscribe((uint32)(self0))
|
||||
result = cm.Reinterpret[poll.Pollable]((uint32)(result0))
|
||||
result = cm.Reinterpret[Pollable]((uint32)(result0))
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:sockets/ip-name-lookup@0.2.0 [method]resolve-address-stream.subscribe
|
||||
//go:noescape
|
||||
func wasmimport_ResolveAddressStreamSubscribe(self0 uint32) (result0 uint32)
|
||||
|
||||
// ResolveAddresses represents the imported function "resolve-addresses".
|
||||
//
|
||||
// Resolve an internet host name to a list of IP addresses.
|
||||
@@ -109,13 +117,9 @@ func wasmimport_ResolveAddressStreamSubscribe(self0 uint32) (result0 uint32)
|
||||
// error-code>
|
||||
//
|
||||
//go:nosplit
|
||||
func ResolveAddresses(network_ network.Network, name string) (result cm.Result[ResolveAddressStream, ResolveAddressStream, network.ErrorCode]) {
|
||||
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
|
||||
}
|
||||
|
||||
//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, network.ErrorCode])
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
||||
|
||||
package ipnamelookup
|
||||
|
||||
import (
|
||||
"internal/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])
|
||||
@@ -3,10 +3,12 @@
|
||||
package network
|
||||
|
||||
import (
|
||||
"internal/cm"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// IPv6SocketAddressShape is used for storage in variant or result types.
|
||||
type IPv6SocketAddressShape struct {
|
||||
_ cm.HostLayout
|
||||
shape [unsafe.Sizeof(IPv6SocketAddress{})]byte
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
@@ -27,10 +27,6 @@ func (self Network) ResourceDrop() {
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:sockets/network@0.2.0 [resource-drop]network
|
||||
//go:noescape
|
||||
func wasmimport_NetworkResourceDrop(self0 uint32)
|
||||
|
||||
// ErrorCode represents the enum "wasi:sockets/network@0.2.0#error-code".
|
||||
//
|
||||
// Error codes.
|
||||
@@ -250,6 +246,16 @@ 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 {
|
||||
@@ -257,6 +263,7 @@ func (self *IPAddress) IPv6() *IPv6Address {
|
||||
// address: ipv4-address,
|
||||
// }
|
||||
type IPv4SocketAddress struct {
|
||||
_ cm.HostLayout
|
||||
// sin_port
|
||||
Port uint16
|
||||
|
||||
@@ -273,6 +280,7 @@ type IPv4SocketAddress struct {
|
||||
// scope-id: u32,
|
||||
// }
|
||||
type IPv6SocketAddress struct {
|
||||
_ cm.HostLayout
|
||||
// sin6_port
|
||||
Port uint16
|
||||
|
||||
@@ -313,3 +321,13 @@ func IPSocketAddressIPv6(data IPv6SocketAddress) IPSocketAddress {
|
||||
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()]
|
||||
}
|
||||
|
||||
@@ -9,6 +9,26 @@ import (
|
||||
"internal/wasi/sockets/v0.2.0/tcp"
|
||||
)
|
||||
|
||||
// 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 a new TCP socket.
|
||||
@@ -41,12 +61,8 @@ import (
|
||||
// error-code>
|
||||
//
|
||||
//go:nosplit
|
||||
func CreateTCPSocket(addressFamily network.IPAddressFamily) (result cm.Result[tcp.TCPSocket, tcp.TCPSocket, network.ErrorCode]) {
|
||||
func CreateTCPSocket(addressFamily IPAddressFamily) (result cm.Result[TCPSocket, TCPSocket, ErrorCode]) {
|
||||
addressFamily0 := (uint32)(addressFamily)
|
||||
wasmimport_CreateTCPSocket((uint32)(addressFamily0), &result)
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:sockets/tcp-create-socket@0.2.0 create-tcp-socket
|
||||
//go:noescape
|
||||
func wasmimport_CreateTCPSocket(addressFamily0 uint32, result *cm.Result[tcp.TCPSocket, tcp.TCPSocket, network.ErrorCode])
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
||||
|
||||
package tcpcreatesocket
|
||||
|
||||
import (
|
||||
"internal/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])
|
||||
@@ -4,23 +4,25 @@ package tcp
|
||||
|
||||
import (
|
||||
"internal/cm"
|
||||
"internal/wasi/io/v0.2.0/streams"
|
||||
"internal/wasi/sockets/v0.2.0/network"
|
||||
"unsafe"
|
||||
)
|
||||
|
||||
// TupleTCPSocketInputStreamOutputStreamShape is used for storage in variant or result types.
|
||||
type TupleTCPSocketInputStreamOutputStreamShape struct {
|
||||
shape [unsafe.Sizeof(cm.Tuple3[TCPSocket, streams.InputStream, streams.OutputStream]{})]byte
|
||||
_ cm.HostLayout
|
||||
shape [unsafe.Sizeof(cm.Tuple3[TCPSocket, InputStream, OutputStream]{})]byte
|
||||
}
|
||||
|
||||
// TupleInputStreamOutputStreamShape is used for storage in variant or result types.
|
||||
type TupleInputStreamOutputStreamShape struct {
|
||||
shape [unsafe.Sizeof(cm.Tuple[streams.InputStream, streams.OutputStream]{})]byte
|
||||
_ 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
|
||||
}
|
||||
|
||||
|
||||
+125
@@ -0,0 +1,125 @@
|
||||
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
||||
|
||||
package tcp
|
||||
|
||||
import (
|
||||
"internal/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)
|
||||
@@ -11,6 +11,46 @@ import (
|
||||
"internal/wasi/sockets/v0.2.0/network"
|
||||
)
|
||||
|
||||
// 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 {
|
||||
@@ -81,10 +121,6 @@ func (self TCPSocket) ResourceDrop() {
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:sockets/tcp@0.2.0 [resource-drop]tcp-socket
|
||||
//go:noescape
|
||||
func wasmimport_TCPSocketResourceDrop(self0 uint32)
|
||||
|
||||
// Accept represents the imported method "accept".
|
||||
//
|
||||
// Accept a new client socket.
|
||||
@@ -120,16 +156,12 @@ func wasmimport_TCPSocketResourceDrop(self0 uint32)
|
||||
// accept: func() -> result<tuple<tcp-socket, input-stream, output-stream>, error-code>
|
||||
//
|
||||
//go:nosplit
|
||||
func (self TCPSocket) Accept() (result cm.Result[TupleTCPSocketInputStreamOutputStreamShape, cm.Tuple3[TCPSocket, streams.InputStream, streams.OutputStream], network.ErrorCode]) {
|
||||
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
|
||||
}
|
||||
|
||||
//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, streams.InputStream, streams.OutputStream], network.ErrorCode])
|
||||
|
||||
// AddressFamily represents the imported method "address-family".
|
||||
//
|
||||
// Whether this is a IPv4 or IPv6 socket.
|
||||
@@ -139,62 +171,46 @@ func wasmimport_TCPSocketAccept(self0 uint32, result *cm.Result[TupleTCPSocketIn
|
||||
// address-family: func() -> ip-address-family
|
||||
//
|
||||
//go:nosplit
|
||||
func (self TCPSocket) AddressFamily() (result network.IPAddressFamily) {
|
||||
func (self TCPSocket) AddressFamily() (result IPAddressFamily) {
|
||||
self0 := cm.Reinterpret[uint32](self)
|
||||
result0 := wasmimport_TCPSocketAddressFamily((uint32)(self0))
|
||||
result = (network.IPAddressFamily)((uint32)(result0))
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:sockets/tcp@0.2.0 [method]tcp-socket.address-family
|
||||
//go:noescape
|
||||
func wasmimport_TCPSocketAddressFamily(self0 uint32) (result0 uint32)
|
||||
|
||||
// FinishBind represents the imported method "finish-bind".
|
||||
//
|
||||
// finish-bind: func() -> result<_, error-code>
|
||||
//
|
||||
//go:nosplit
|
||||
func (self TCPSocket) FinishBind() (result cm.Result[network.ErrorCode, struct{}, network.ErrorCode]) {
|
||||
func (self TCPSocket) FinishBind() (result cm.Result[ErrorCode, struct{}, ErrorCode]) {
|
||||
self0 := cm.Reinterpret[uint32](self)
|
||||
wasmimport_TCPSocketFinishBind((uint32)(self0), &result)
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:sockets/tcp@0.2.0 [method]tcp-socket.finish-bind
|
||||
//go:noescape
|
||||
func wasmimport_TCPSocketFinishBind(self0 uint32, result *cm.Result[network.ErrorCode, struct{}, network.ErrorCode])
|
||||
|
||||
// FinishConnect represents the imported method "finish-connect".
|
||||
//
|
||||
// finish-connect: func() -> result<tuple<input-stream, output-stream>, error-code>
|
||||
//
|
||||
//go:nosplit
|
||||
func (self TCPSocket) FinishConnect() (result cm.Result[TupleInputStreamOutputStreamShape, cm.Tuple[streams.InputStream, streams.OutputStream], network.ErrorCode]) {
|
||||
func (self TCPSocket) FinishConnect() (result cm.Result[TupleInputStreamOutputStreamShape, cm.Tuple[InputStream, OutputStream], ErrorCode]) {
|
||||
self0 := cm.Reinterpret[uint32](self)
|
||||
wasmimport_TCPSocketFinishConnect((uint32)(self0), &result)
|
||||
return
|
||||
}
|
||||
|
||||
//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[streams.InputStream, streams.OutputStream], network.ErrorCode])
|
||||
|
||||
// FinishListen represents the imported method "finish-listen".
|
||||
//
|
||||
// finish-listen: func() -> result<_, error-code>
|
||||
//
|
||||
//go:nosplit
|
||||
func (self TCPSocket) FinishListen() (result cm.Result[network.ErrorCode, struct{}, network.ErrorCode]) {
|
||||
func (self TCPSocket) FinishListen() (result cm.Result[ErrorCode, struct{}, ErrorCode]) {
|
||||
self0 := cm.Reinterpret[uint32](self)
|
||||
wasmimport_TCPSocketFinishListen((uint32)(self0), &result)
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:sockets/tcp@0.2.0 [method]tcp-socket.finish-listen
|
||||
//go:noescape
|
||||
func wasmimport_TCPSocketFinishListen(self0 uint32, result *cm.Result[network.ErrorCode, struct{}, network.ErrorCode])
|
||||
|
||||
// HopLimit represents the imported method "hop-limit".
|
||||
//
|
||||
// Equivalent to the IP_TTL & IPV6_UNICAST_HOPS socket options.
|
||||
@@ -207,16 +223,12 @@ func wasmimport_TCPSocketFinishListen(self0 uint32, result *cm.Result[network.Er
|
||||
// hop-limit: func() -> result<u8, error-code>
|
||||
//
|
||||
//go:nosplit
|
||||
func (self TCPSocket) HopLimit() (result cm.Result[uint8, uint8, network.ErrorCode]) {
|
||||
func (self TCPSocket) HopLimit() (result cm.Result[uint8, uint8, ErrorCode]) {
|
||||
self0 := cm.Reinterpret[uint32](self)
|
||||
wasmimport_TCPSocketHopLimit((uint32)(self0), &result)
|
||||
return
|
||||
}
|
||||
|
||||
//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, network.ErrorCode])
|
||||
|
||||
// IsListening represents the imported method "is-listening".
|
||||
//
|
||||
// Whether the socket is in the `listening` state.
|
||||
@@ -233,10 +245,6 @@ func (self TCPSocket) IsListening() (result bool) {
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:sockets/tcp@0.2.0 [method]tcp-socket.is-listening
|
||||
//go:noescape
|
||||
func wasmimport_TCPSocketIsListening(self0 uint32) (result0 uint32)
|
||||
|
||||
// KeepAliveCount represents the imported method "keep-alive-count".
|
||||
//
|
||||
// The maximum amount of keepalive packets TCP should send before aborting the connection.
|
||||
@@ -255,16 +263,12 @@ func wasmimport_TCPSocketIsListening(self0 uint32) (result0 uint32)
|
||||
// keep-alive-count: func() -> result<u32, error-code>
|
||||
//
|
||||
//go:nosplit
|
||||
func (self TCPSocket) KeepAliveCount() (result cm.Result[uint32, uint32, network.ErrorCode]) {
|
||||
func (self TCPSocket) KeepAliveCount() (result cm.Result[uint32, uint32, ErrorCode]) {
|
||||
self0 := cm.Reinterpret[uint32](self)
|
||||
wasmimport_TCPSocketKeepAliveCount((uint32)(self0), &result)
|
||||
return
|
||||
}
|
||||
|
||||
//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, network.ErrorCode])
|
||||
|
||||
// KeepAliveEnabled represents the imported method "keep-alive-enabled".
|
||||
//
|
||||
// Enables or disables keepalive.
|
||||
@@ -281,16 +285,12 @@ func wasmimport_TCPSocketKeepAliveCount(self0 uint32, result *cm.Result[uint32,
|
||||
// keep-alive-enabled: func() -> result<bool, error-code>
|
||||
//
|
||||
//go:nosplit
|
||||
func (self TCPSocket) KeepAliveEnabled() (result cm.Result[bool, bool, network.ErrorCode]) {
|
||||
func (self TCPSocket) KeepAliveEnabled() (result cm.Result[bool, bool, ErrorCode]) {
|
||||
self0 := cm.Reinterpret[uint32](self)
|
||||
wasmimport_TCPSocketKeepAliveEnabled((uint32)(self0), &result)
|
||||
return
|
||||
}
|
||||
|
||||
//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, network.ErrorCode])
|
||||
|
||||
// KeepAliveIdleTime represents the imported method "keep-alive-idle-time".
|
||||
//
|
||||
// Amount of time the connection has to be idle before TCP starts sending keepalive
|
||||
@@ -310,16 +310,12 @@ func wasmimport_TCPSocketKeepAliveEnabled(self0 uint32, result *cm.Result[bool,
|
||||
// keep-alive-idle-time: func() -> result<duration, error-code>
|
||||
//
|
||||
//go:nosplit
|
||||
func (self TCPSocket) KeepAliveIdleTime() (result cm.Result[uint64, monotonicclock.Duration, network.ErrorCode]) {
|
||||
func (self TCPSocket) KeepAliveIdleTime() (result cm.Result[uint64, Duration, ErrorCode]) {
|
||||
self0 := cm.Reinterpret[uint32](self)
|
||||
wasmimport_TCPSocketKeepAliveIdleTime((uint32)(self0), &result)
|
||||
return
|
||||
}
|
||||
|
||||
//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, monotonicclock.Duration, network.ErrorCode])
|
||||
|
||||
// KeepAliveInterval represents the imported method "keep-alive-interval".
|
||||
//
|
||||
// The time between keepalive packets.
|
||||
@@ -338,16 +334,12 @@ func wasmimport_TCPSocketKeepAliveIdleTime(self0 uint32, result *cm.Result[uint6
|
||||
// keep-alive-interval: func() -> result<duration, error-code>
|
||||
//
|
||||
//go:nosplit
|
||||
func (self TCPSocket) KeepAliveInterval() (result cm.Result[uint64, monotonicclock.Duration, network.ErrorCode]) {
|
||||
func (self TCPSocket) KeepAliveInterval() (result cm.Result[uint64, Duration, ErrorCode]) {
|
||||
self0 := cm.Reinterpret[uint32](self)
|
||||
wasmimport_TCPSocketKeepAliveInterval((uint32)(self0), &result)
|
||||
return
|
||||
}
|
||||
|
||||
//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, monotonicclock.Duration, network.ErrorCode])
|
||||
|
||||
// LocalAddress represents the imported method "local-address".
|
||||
//
|
||||
// Get the bound local address.
|
||||
@@ -371,16 +363,12 @@ func wasmimport_TCPSocketKeepAliveInterval(self0 uint32, result *cm.Result[uint6
|
||||
// local-address: func() -> result<ip-socket-address, error-code>
|
||||
//
|
||||
//go:nosplit
|
||||
func (self TCPSocket) LocalAddress() (result cm.Result[IPSocketAddressShape, network.IPSocketAddress, network.ErrorCode]) {
|
||||
func (self TCPSocket) LocalAddress() (result cm.Result[IPSocketAddressShape, IPSocketAddress, ErrorCode]) {
|
||||
self0 := cm.Reinterpret[uint32](self)
|
||||
wasmimport_TCPSocketLocalAddress((uint32)(self0), &result)
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:sockets/tcp@0.2.0 [method]tcp-socket.local-address
|
||||
//go:noescape
|
||||
func wasmimport_TCPSocketLocalAddress(self0 uint32, result *cm.Result[IPSocketAddressShape, network.IPSocketAddress, network.ErrorCode])
|
||||
|
||||
// ReceiveBufferSize represents the imported method "receive-buffer-size".
|
||||
//
|
||||
// The kernel buffer space reserved for sends/receives on this socket.
|
||||
@@ -399,16 +387,12 @@ func wasmimport_TCPSocketLocalAddress(self0 uint32, result *cm.Result[IPSocketAd
|
||||
// receive-buffer-size: func() -> result<u64, error-code>
|
||||
//
|
||||
//go:nosplit
|
||||
func (self TCPSocket) ReceiveBufferSize() (result cm.Result[uint64, uint64, network.ErrorCode]) {
|
||||
func (self TCPSocket) ReceiveBufferSize() (result cm.Result[uint64, uint64, ErrorCode]) {
|
||||
self0 := cm.Reinterpret[uint32](self)
|
||||
wasmimport_TCPSocketReceiveBufferSize((uint32)(self0), &result)
|
||||
return
|
||||
}
|
||||
|
||||
//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, network.ErrorCode])
|
||||
|
||||
// RemoteAddress represents the imported method "remote-address".
|
||||
//
|
||||
// Get the remote address.
|
||||
@@ -425,111 +409,83 @@ func wasmimport_TCPSocketReceiveBufferSize(self0 uint32, result *cm.Result[uint6
|
||||
// remote-address: func() -> result<ip-socket-address, error-code>
|
||||
//
|
||||
//go:nosplit
|
||||
func (self TCPSocket) RemoteAddress() (result cm.Result[IPSocketAddressShape, network.IPSocketAddress, network.ErrorCode]) {
|
||||
func (self TCPSocket) RemoteAddress() (result cm.Result[IPSocketAddressShape, IPSocketAddress, ErrorCode]) {
|
||||
self0 := cm.Reinterpret[uint32](self)
|
||||
wasmimport_TCPSocketRemoteAddress((uint32)(self0), &result)
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:sockets/tcp@0.2.0 [method]tcp-socket.remote-address
|
||||
//go:noescape
|
||||
func wasmimport_TCPSocketRemoteAddress(self0 uint32, result *cm.Result[IPSocketAddressShape, network.IPSocketAddress, network.ErrorCode])
|
||||
|
||||
// SendBufferSize represents the imported method "send-buffer-size".
|
||||
//
|
||||
// send-buffer-size: func() -> result<u64, error-code>
|
||||
//
|
||||
//go:nosplit
|
||||
func (self TCPSocket) SendBufferSize() (result cm.Result[uint64, uint64, network.ErrorCode]) {
|
||||
func (self TCPSocket) SendBufferSize() (result cm.Result[uint64, uint64, ErrorCode]) {
|
||||
self0 := cm.Reinterpret[uint32](self)
|
||||
wasmimport_TCPSocketSendBufferSize((uint32)(self0), &result)
|
||||
return
|
||||
}
|
||||
|
||||
//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, network.ErrorCode])
|
||||
|
||||
// SetHopLimit represents the imported method "set-hop-limit".
|
||||
//
|
||||
// set-hop-limit: func(value: u8) -> result<_, error-code>
|
||||
//
|
||||
//go:nosplit
|
||||
func (self TCPSocket) SetHopLimit(value uint8) (result cm.Result[network.ErrorCode, struct{}, network.ErrorCode]) {
|
||||
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
|
||||
}
|
||||
|
||||
//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[network.ErrorCode, struct{}, network.ErrorCode])
|
||||
|
||||
// SetKeepAliveCount represents the imported method "set-keep-alive-count".
|
||||
//
|
||||
// set-keep-alive-count: func(value: u32) -> result<_, error-code>
|
||||
//
|
||||
//go:nosplit
|
||||
func (self TCPSocket) SetKeepAliveCount(value uint32) (result cm.Result[network.ErrorCode, struct{}, network.ErrorCode]) {
|
||||
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
|
||||
}
|
||||
|
||||
//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[network.ErrorCode, struct{}, network.ErrorCode])
|
||||
|
||||
// SetKeepAliveEnabled represents the imported method "set-keep-alive-enabled".
|
||||
//
|
||||
// set-keep-alive-enabled: func(value: bool) -> result<_, error-code>
|
||||
//
|
||||
//go:nosplit
|
||||
func (self TCPSocket) SetKeepAliveEnabled(value bool) (result cm.Result[network.ErrorCode, struct{}, network.ErrorCode]) {
|
||||
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
|
||||
}
|
||||
|
||||
//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[network.ErrorCode, struct{}, network.ErrorCode])
|
||||
|
||||
// SetKeepAliveIdleTime represents the imported method "set-keep-alive-idle-time".
|
||||
//
|
||||
// set-keep-alive-idle-time: func(value: duration) -> result<_, error-code>
|
||||
//
|
||||
//go:nosplit
|
||||
func (self TCPSocket) SetKeepAliveIdleTime(value monotonicclock.Duration) (result cm.Result[network.ErrorCode, struct{}, network.ErrorCode]) {
|
||||
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
|
||||
}
|
||||
|
||||
//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[network.ErrorCode, struct{}, network.ErrorCode])
|
||||
|
||||
// SetKeepAliveInterval represents the imported method "set-keep-alive-interval".
|
||||
//
|
||||
// set-keep-alive-interval: func(value: duration) -> result<_, error-code>
|
||||
//
|
||||
//go:nosplit
|
||||
func (self TCPSocket) SetKeepAliveInterval(value monotonicclock.Duration) (result cm.Result[network.ErrorCode, struct{}, network.ErrorCode]) {
|
||||
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
|
||||
}
|
||||
|
||||
//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[network.ErrorCode, struct{}, network.ErrorCode])
|
||||
|
||||
// SetListenBacklogSize represents the imported method "set-listen-backlog-size".
|
||||
//
|
||||
// Hints the desired listen queue size. Implementations are free to ignore this.
|
||||
@@ -548,49 +504,37 @@ func wasmimport_TCPSocketSetKeepAliveInterval(self0 uint32, value0 uint64, resul
|
||||
// set-listen-backlog-size: func(value: u64) -> result<_, error-code>
|
||||
//
|
||||
//go:nosplit
|
||||
func (self TCPSocket) SetListenBacklogSize(value uint64) (result cm.Result[network.ErrorCode, struct{}, network.ErrorCode]) {
|
||||
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
|
||||
}
|
||||
|
||||
//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[network.ErrorCode, struct{}, network.ErrorCode])
|
||||
|
||||
// SetReceiveBufferSize represents the imported method "set-receive-buffer-size".
|
||||
//
|
||||
// set-receive-buffer-size: func(value: u64) -> result<_, error-code>
|
||||
//
|
||||
//go:nosplit
|
||||
func (self TCPSocket) SetReceiveBufferSize(value uint64) (result cm.Result[network.ErrorCode, struct{}, network.ErrorCode]) {
|
||||
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
|
||||
}
|
||||
|
||||
//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[network.ErrorCode, struct{}, network.ErrorCode])
|
||||
|
||||
// SetSendBufferSize represents the imported method "set-send-buffer-size".
|
||||
//
|
||||
// set-send-buffer-size: func(value: u64) -> result<_, error-code>
|
||||
//
|
||||
//go:nosplit
|
||||
func (self TCPSocket) SetSendBufferSize(value uint64) (result cm.Result[network.ErrorCode, struct{}, network.ErrorCode]) {
|
||||
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
|
||||
}
|
||||
|
||||
//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[network.ErrorCode, struct{}, network.ErrorCode])
|
||||
|
||||
// Shutdown represents the imported method "shutdown".
|
||||
//
|
||||
// Initiate a graceful shutdown.
|
||||
@@ -620,17 +564,13 @@ func wasmimport_TCPSocketSetSendBufferSize(self0 uint32, value0 uint64, result *
|
||||
// shutdown: func(shutdown-type: shutdown-type) -> result<_, error-code>
|
||||
//
|
||||
//go:nosplit
|
||||
func (self TCPSocket) Shutdown(shutdownType ShutdownType) (result cm.Result[network.ErrorCode, struct{}, network.ErrorCode]) {
|
||||
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
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:sockets/tcp@0.2.0 [method]tcp-socket.shutdown
|
||||
//go:noescape
|
||||
func wasmimport_TCPSocketShutdown(self0 uint32, shutdownType0 uint32, result *cm.Result[network.ErrorCode, struct{}, network.ErrorCode])
|
||||
|
||||
// StartBind represents the imported method "start-bind".
|
||||
//
|
||||
// Bind the socket to a specific network on the provided IP address and port.
|
||||
@@ -685,7 +625,7 @@ func wasmimport_TCPSocketShutdown(self0 uint32, shutdownType0 uint32, result *cm
|
||||
// result<_, error-code>
|
||||
//
|
||||
//go:nosplit
|
||||
func (self TCPSocket) StartBind(network_ network.Network, localAddress network.IPSocketAddress) (result cm.Result[network.ErrorCode, struct{}, network.ErrorCode]) {
|
||||
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)
|
||||
@@ -693,10 +633,6 @@ func (self TCPSocket) StartBind(network_ network.Network, localAddress network.I
|
||||
return
|
||||
}
|
||||
|
||||
//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[network.ErrorCode, struct{}, network.ErrorCode])
|
||||
|
||||
// StartConnect represents the imported method "start-connect".
|
||||
//
|
||||
// Connect to a remote endpoint.
|
||||
@@ -757,7 +693,7 @@ func wasmimport_TCPSocketStartBind(self0 uint32, network0 uint32, localAddress0
|
||||
// -> result<_, error-code>
|
||||
//
|
||||
//go:nosplit
|
||||
func (self TCPSocket) StartConnect(network_ network.Network, remoteAddress network.IPSocketAddress) (result cm.Result[network.ErrorCode, struct{}, network.ErrorCode]) {
|
||||
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)
|
||||
@@ -765,10 +701,6 @@ func (self TCPSocket) StartConnect(network_ network.Network, remoteAddress netwo
|
||||
return
|
||||
}
|
||||
|
||||
//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[network.ErrorCode, struct{}, network.ErrorCode])
|
||||
|
||||
// StartListen represents the imported method "start-listen".
|
||||
//
|
||||
// Start listening for new connections.
|
||||
@@ -803,16 +735,12 @@ func wasmimport_TCPSocketStartConnect(self0 uint32, network0 uint32, remoteAddre
|
||||
// start-listen: func() -> result<_, error-code>
|
||||
//
|
||||
//go:nosplit
|
||||
func (self TCPSocket) StartListen() (result cm.Result[network.ErrorCode, struct{}, network.ErrorCode]) {
|
||||
func (self TCPSocket) StartListen() (result cm.Result[ErrorCode, struct{}, ErrorCode]) {
|
||||
self0 := cm.Reinterpret[uint32](self)
|
||||
wasmimport_TCPSocketStartListen((uint32)(self0), &result)
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:sockets/tcp@0.2.0 [method]tcp-socket.start-listen
|
||||
//go:noescape
|
||||
func wasmimport_TCPSocketStartListen(self0 uint32, result *cm.Result[network.ErrorCode, struct{}, network.ErrorCode])
|
||||
|
||||
// Subscribe represents the imported method "subscribe".
|
||||
//
|
||||
// Create a `pollable` which can be used to poll for, or block on,
|
||||
@@ -836,13 +764,9 @@ func wasmimport_TCPSocketStartListen(self0 uint32, result *cm.Result[network.Err
|
||||
// subscribe: func() -> pollable
|
||||
//
|
||||
//go:nosplit
|
||||
func (self TCPSocket) Subscribe() (result poll.Pollable) {
|
||||
func (self TCPSocket) Subscribe() (result Pollable) {
|
||||
self0 := cm.Reinterpret[uint32](self)
|
||||
result0 := wasmimport_TCPSocketSubscribe((uint32)(self0))
|
||||
result = cm.Reinterpret[poll.Pollable]((uint32)(result0))
|
||||
result = cm.Reinterpret[Pollable]((uint32)(result0))
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:sockets/tcp@0.2.0 [method]tcp-socket.subscribe
|
||||
//go:noescape
|
||||
func wasmimport_TCPSocketSubscribe(self0 uint32) (result0 uint32)
|
||||
|
||||
@@ -9,6 +9,26 @@ import (
|
||||
"internal/wasi/sockets/v0.2.0/udp"
|
||||
)
|
||||
|
||||
// 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 a new UDP socket.
|
||||
@@ -41,12 +61,8 @@ import (
|
||||
// error-code>
|
||||
//
|
||||
//go:nosplit
|
||||
func CreateUDPSocket(addressFamily network.IPAddressFamily) (result cm.Result[udp.UDPSocket, udp.UDPSocket, network.ErrorCode]) {
|
||||
func CreateUDPSocket(addressFamily IPAddressFamily) (result cm.Result[UDPSocket, UDPSocket, ErrorCode]) {
|
||||
addressFamily0 := (uint32)(addressFamily)
|
||||
wasmimport_CreateUDPSocket((uint32)(addressFamily0), &result)
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:sockets/udp-create-socket@0.2.0 create-udp-socket
|
||||
//go:noescape
|
||||
func wasmimport_CreateUDPSocket(addressFamily0 uint32, result *cm.Result[udp.UDPSocket, udp.UDPSocket, network.ErrorCode])
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
||||
|
||||
package udpcreatesocket
|
||||
|
||||
import (
|
||||
"internal/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])
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
|
||||
// IPSocketAddressShape is used for storage in variant or result types.
|
||||
type IPSocketAddressShape struct {
|
||||
_ cm.HostLayout
|
||||
shape [unsafe.Sizeof(network.IPSocketAddress{})]byte
|
||||
}
|
||||
|
||||
@@ -76,10 +77,11 @@ func lower_IPSocketAddress(v network.IPSocketAddress) (f0 uint32, f1 uint32, f2
|
||||
|
||||
// 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[network.IPSocketAddress]) (f0 uint32, f1 uint32, f2 uint32, f3 uint32, f4 uint32, f5 uint32, f6 uint32, f7 uint32, f8 uint32, f9 uint32, f10 uint32, f11 uint32, f12 uint32) {
|
||||
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
|
||||
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
// Code generated by wit-bindgen-go. DO NOT EDIT.
|
||||
|
||||
package udp
|
||||
|
||||
import (
|
||||
"internal/cm"
|
||||
)
|
||||
|
||||
// This file contains wasmimport and wasmexport declarations for "wasi:sockets@0.2.0".
|
||||
|
||||
//go:wasmimport wasi:sockets/udp@0.2.0 [resource-drop]udp-socket
|
||||
//go:noescape
|
||||
func wasmimport_UDPSocketResourceDrop(self0 uint32)
|
||||
|
||||
//go:wasmimport wasi:sockets/udp@0.2.0 [method]udp-socket.address-family
|
||||
//go:noescape
|
||||
func wasmimport_UDPSocketAddressFamily(self0 uint32) (result0 uint32)
|
||||
|
||||
//go:wasmimport wasi:sockets/udp@0.2.0 [method]udp-socket.finish-bind
|
||||
//go:noescape
|
||||
func wasmimport_UDPSocketFinishBind(self0 uint32, result *cm.Result[ErrorCode, struct{}, ErrorCode])
|
||||
|
||||
//go:wasmimport wasi:sockets/udp@0.2.0 [method]udp-socket.local-address
|
||||
//go:noescape
|
||||
func wasmimport_UDPSocketLocalAddress(self0 uint32, result *cm.Result[IPSocketAddressShape, IPSocketAddress, ErrorCode])
|
||||
|
||||
//go:wasmimport wasi:sockets/udp@0.2.0 [method]udp-socket.receive-buffer-size
|
||||
//go:noescape
|
||||
func wasmimport_UDPSocketReceiveBufferSize(self0 uint32, result *cm.Result[uint64, uint64, ErrorCode])
|
||||
|
||||
//go:wasmimport wasi:sockets/udp@0.2.0 [method]udp-socket.remote-address
|
||||
//go:noescape
|
||||
func wasmimport_UDPSocketRemoteAddress(self0 uint32, result *cm.Result[IPSocketAddressShape, IPSocketAddress, ErrorCode])
|
||||
|
||||
//go:wasmimport wasi:sockets/udp@0.2.0 [method]udp-socket.send-buffer-size
|
||||
//go:noescape
|
||||
func wasmimport_UDPSocketSendBufferSize(self0 uint32, result *cm.Result[uint64, uint64, ErrorCode])
|
||||
|
||||
//go:wasmimport wasi:sockets/udp@0.2.0 [method]udp-socket.set-receive-buffer-size
|
||||
//go:noescape
|
||||
func wasmimport_UDPSocketSetReceiveBufferSize(self0 uint32, value0 uint64, result *cm.Result[ErrorCode, struct{}, ErrorCode])
|
||||
|
||||
//go:wasmimport wasi:sockets/udp@0.2.0 [method]udp-socket.set-send-buffer-size
|
||||
//go:noescape
|
||||
func wasmimport_UDPSocketSetSendBufferSize(self0 uint32, value0 uint64, result *cm.Result[ErrorCode, struct{}, ErrorCode])
|
||||
|
||||
//go:wasmimport wasi:sockets/udp@0.2.0 [method]udp-socket.set-unicast-hop-limit
|
||||
//go:noescape
|
||||
func wasmimport_UDPSocketSetUnicastHopLimit(self0 uint32, value0 uint32, result *cm.Result[ErrorCode, struct{}, ErrorCode])
|
||||
|
||||
//go:wasmimport wasi:sockets/udp@0.2.0 [method]udp-socket.start-bind
|
||||
//go:noescape
|
||||
func wasmimport_UDPSocketStartBind(self0 uint32, network0 uint32, localAddress0 uint32, localAddress1 uint32, localAddress2 uint32, localAddress3 uint32, localAddress4 uint32, localAddress5 uint32, localAddress6 uint32, localAddress7 uint32, localAddress8 uint32, localAddress9 uint32, localAddress10 uint32, localAddress11 uint32, result *cm.Result[ErrorCode, struct{}, ErrorCode])
|
||||
|
||||
//go:wasmimport wasi:sockets/udp@0.2.0 [method]udp-socket.stream
|
||||
//go:noescape
|
||||
func wasmimport_UDPSocketStream(self0 uint32, remoteAddress0 uint32, remoteAddress1 uint32, remoteAddress2 uint32, remoteAddress3 uint32, remoteAddress4 uint32, remoteAddress5 uint32, remoteAddress6 uint32, remoteAddress7 uint32, remoteAddress8 uint32, remoteAddress9 uint32, remoteAddress10 uint32, remoteAddress11 uint32, remoteAddress12 uint32, result *cm.Result[TupleIncomingDatagramStreamOutgoingDatagramStreamShape, cm.Tuple[IncomingDatagramStream, OutgoingDatagramStream], ErrorCode])
|
||||
|
||||
//go:wasmimport wasi:sockets/udp@0.2.0 [method]udp-socket.subscribe
|
||||
//go:noescape
|
||||
func wasmimport_UDPSocketSubscribe(self0 uint32) (result0 uint32)
|
||||
|
||||
//go:wasmimport wasi:sockets/udp@0.2.0 [method]udp-socket.unicast-hop-limit
|
||||
//go:noescape
|
||||
func wasmimport_UDPSocketUnicastHopLimit(self0 uint32, result *cm.Result[uint8, uint8, ErrorCode])
|
||||
|
||||
//go:wasmimport wasi:sockets/udp@0.2.0 [resource-drop]incoming-datagram-stream
|
||||
//go:noescape
|
||||
func wasmimport_IncomingDatagramStreamResourceDrop(self0 uint32)
|
||||
|
||||
//go:wasmimport wasi:sockets/udp@0.2.0 [method]incoming-datagram-stream.receive
|
||||
//go:noescape
|
||||
func wasmimport_IncomingDatagramStreamReceive(self0 uint32, maxResults0 uint64, result *cm.Result[cm.List[IncomingDatagram], cm.List[IncomingDatagram], ErrorCode])
|
||||
|
||||
//go:wasmimport wasi:sockets/udp@0.2.0 [method]incoming-datagram-stream.subscribe
|
||||
//go:noescape
|
||||
func wasmimport_IncomingDatagramStreamSubscribe(self0 uint32) (result0 uint32)
|
||||
|
||||
//go:wasmimport wasi:sockets/udp@0.2.0 [resource-drop]outgoing-datagram-stream
|
||||
//go:noescape
|
||||
func wasmimport_OutgoingDatagramStreamResourceDrop(self0 uint32)
|
||||
|
||||
//go:wasmimport wasi:sockets/udp@0.2.0 [method]outgoing-datagram-stream.check-send
|
||||
//go:noescape
|
||||
func wasmimport_OutgoingDatagramStreamCheckSend(self0 uint32, result *cm.Result[uint64, uint64, ErrorCode])
|
||||
|
||||
//go:wasmimport wasi:sockets/udp@0.2.0 [method]outgoing-datagram-stream.send
|
||||
//go:noescape
|
||||
func wasmimport_OutgoingDatagramStreamSend(self0 uint32, datagrams0 *OutgoingDatagram, datagrams1 uint32, result *cm.Result[uint64, uint64, ErrorCode])
|
||||
|
||||
//go:wasmimport wasi:sockets/udp@0.2.0 [method]outgoing-datagram-stream.subscribe
|
||||
//go:noescape
|
||||
func wasmimport_OutgoingDatagramStreamSubscribe(self0 uint32) (result0 uint32)
|
||||
@@ -9,6 +9,31 @@ import (
|
||||
"internal/wasi/sockets/v0.2.0/network"
|
||||
)
|
||||
|
||||
// Pollable represents the imported type alias "wasi:sockets/udp@0.2.0#pollable".
|
||||
//
|
||||
// See [poll.Pollable] for more information.
|
||||
type Pollable = poll.Pollable
|
||||
|
||||
// Network represents the imported type alias "wasi:sockets/udp@0.2.0#network".
|
||||
//
|
||||
// See [network.Network] for more information.
|
||||
type Network = network.Network
|
||||
|
||||
// ErrorCode represents the type alias "wasi:sockets/udp@0.2.0#error-code".
|
||||
//
|
||||
// See [network.ErrorCode] for more information.
|
||||
type ErrorCode = network.ErrorCode
|
||||
|
||||
// IPSocketAddress represents the type alias "wasi:sockets/udp@0.2.0#ip-socket-address".
|
||||
//
|
||||
// See [network.IPSocketAddress] for more information.
|
||||
type IPSocketAddress = network.IPSocketAddress
|
||||
|
||||
// IPAddressFamily represents the type alias "wasi:sockets/udp@0.2.0#ip-address-family".
|
||||
//
|
||||
// See [network.IPAddressFamily] for more information.
|
||||
type IPAddressFamily = network.IPAddressFamily
|
||||
|
||||
// IncomingDatagram represents the record "wasi:sockets/udp@0.2.0#incoming-datagram".
|
||||
//
|
||||
// A received datagram.
|
||||
@@ -18,6 +43,7 @@ import (
|
||||
// remote-address: ip-socket-address,
|
||||
// }
|
||||
type IncomingDatagram struct {
|
||||
_ cm.HostLayout
|
||||
// The payload.
|
||||
//
|
||||
// Theoretical max size: ~64 KiB. In practice, typically less than 1500 bytes.
|
||||
@@ -29,7 +55,7 @@ type IncomingDatagram struct {
|
||||
// with, if any.
|
||||
//
|
||||
// Equivalent to the `src_addr` out parameter of `recvfrom`.
|
||||
RemoteAddress network.IPSocketAddress
|
||||
RemoteAddress IPSocketAddress
|
||||
}
|
||||
|
||||
// OutgoingDatagram represents the record "wasi:sockets/udp@0.2.0#outgoing-datagram".
|
||||
@@ -41,6 +67,7 @@ type IncomingDatagram struct {
|
||||
// remote-address: option<ip-socket-address>,
|
||||
// }
|
||||
type OutgoingDatagram struct {
|
||||
_ cm.HostLayout
|
||||
// The payload.
|
||||
Data cm.List[uint8]
|
||||
|
||||
@@ -53,7 +80,7 @@ type OutgoingDatagram struct {
|
||||
//
|
||||
// If this value is None, the send operation is equivalent to `send` in POSIX. Otherwise
|
||||
// it is equivalent to `sendto`.
|
||||
RemoteAddress cm.Option[network.IPSocketAddress]
|
||||
RemoteAddress cm.Option[IPSocketAddress]
|
||||
}
|
||||
|
||||
// UDPSocket represents the imported resource "wasi:sockets/udp@0.2.0#udp-socket".
|
||||
@@ -74,10 +101,6 @@ func (self UDPSocket) ResourceDrop() {
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:sockets/udp@0.2.0 [resource-drop]udp-socket
|
||||
//go:noescape
|
||||
func wasmimport_UDPSocketResourceDrop(self0 uint32)
|
||||
|
||||
// AddressFamily represents the imported method "address-family".
|
||||
//
|
||||
// Whether this is a IPv4 or IPv6 socket.
|
||||
@@ -87,32 +110,24 @@ func wasmimport_UDPSocketResourceDrop(self0 uint32)
|
||||
// address-family: func() -> ip-address-family
|
||||
//
|
||||
//go:nosplit
|
||||
func (self UDPSocket) AddressFamily() (result network.IPAddressFamily) {
|
||||
func (self UDPSocket) AddressFamily() (result IPAddressFamily) {
|
||||
self0 := cm.Reinterpret[uint32](self)
|
||||
result0 := wasmimport_UDPSocketAddressFamily((uint32)(self0))
|
||||
result = (network.IPAddressFamily)((uint32)(result0))
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:sockets/udp@0.2.0 [method]udp-socket.address-family
|
||||
//go:noescape
|
||||
func wasmimport_UDPSocketAddressFamily(self0 uint32) (result0 uint32)
|
||||
|
||||
// FinishBind represents the imported method "finish-bind".
|
||||
//
|
||||
// finish-bind: func() -> result<_, error-code>
|
||||
//
|
||||
//go:nosplit
|
||||
func (self UDPSocket) FinishBind() (result cm.Result[network.ErrorCode, struct{}, network.ErrorCode]) {
|
||||
func (self UDPSocket) FinishBind() (result cm.Result[ErrorCode, struct{}, ErrorCode]) {
|
||||
self0 := cm.Reinterpret[uint32](self)
|
||||
wasmimport_UDPSocketFinishBind((uint32)(self0), &result)
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:sockets/udp@0.2.0 [method]udp-socket.finish-bind
|
||||
//go:noescape
|
||||
func wasmimport_UDPSocketFinishBind(self0 uint32, result *cm.Result[network.ErrorCode, struct{}, network.ErrorCode])
|
||||
|
||||
// LocalAddress represents the imported method "local-address".
|
||||
//
|
||||
// Get the current bound address.
|
||||
@@ -136,16 +151,12 @@ func wasmimport_UDPSocketFinishBind(self0 uint32, result *cm.Result[network.Erro
|
||||
// local-address: func() -> result<ip-socket-address, error-code>
|
||||
//
|
||||
//go:nosplit
|
||||
func (self UDPSocket) LocalAddress() (result cm.Result[IPSocketAddressShape, network.IPSocketAddress, network.ErrorCode]) {
|
||||
func (self UDPSocket) LocalAddress() (result cm.Result[IPSocketAddressShape, IPSocketAddress, ErrorCode]) {
|
||||
self0 := cm.Reinterpret[uint32](self)
|
||||
wasmimport_UDPSocketLocalAddress((uint32)(self0), &result)
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:sockets/udp@0.2.0 [method]udp-socket.local-address
|
||||
//go:noescape
|
||||
func wasmimport_UDPSocketLocalAddress(self0 uint32, result *cm.Result[IPSocketAddressShape, network.IPSocketAddress, network.ErrorCode])
|
||||
|
||||
// ReceiveBufferSize represents the imported method "receive-buffer-size".
|
||||
//
|
||||
// The kernel buffer space reserved for sends/receives on this socket.
|
||||
@@ -164,16 +175,12 @@ func wasmimport_UDPSocketLocalAddress(self0 uint32, result *cm.Result[IPSocketAd
|
||||
// receive-buffer-size: func() -> result<u64, error-code>
|
||||
//
|
||||
//go:nosplit
|
||||
func (self UDPSocket) ReceiveBufferSize() (result cm.Result[uint64, uint64, network.ErrorCode]) {
|
||||
func (self UDPSocket) ReceiveBufferSize() (result cm.Result[uint64, uint64, ErrorCode]) {
|
||||
self0 := cm.Reinterpret[uint32](self)
|
||||
wasmimport_UDPSocketReceiveBufferSize((uint32)(self0), &result)
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:sockets/udp@0.2.0 [method]udp-socket.receive-buffer-size
|
||||
//go:noescape
|
||||
func wasmimport_UDPSocketReceiveBufferSize(self0 uint32, result *cm.Result[uint64, uint64, network.ErrorCode])
|
||||
|
||||
// RemoteAddress represents the imported method "remote-address".
|
||||
//
|
||||
// Get the address the socket is currently streaming to.
|
||||
@@ -190,79 +197,59 @@ func wasmimport_UDPSocketReceiveBufferSize(self0 uint32, result *cm.Result[uint6
|
||||
// remote-address: func() -> result<ip-socket-address, error-code>
|
||||
//
|
||||
//go:nosplit
|
||||
func (self UDPSocket) RemoteAddress() (result cm.Result[IPSocketAddressShape, network.IPSocketAddress, network.ErrorCode]) {
|
||||
func (self UDPSocket) RemoteAddress() (result cm.Result[IPSocketAddressShape, IPSocketAddress, ErrorCode]) {
|
||||
self0 := cm.Reinterpret[uint32](self)
|
||||
wasmimport_UDPSocketRemoteAddress((uint32)(self0), &result)
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:sockets/udp@0.2.0 [method]udp-socket.remote-address
|
||||
//go:noescape
|
||||
func wasmimport_UDPSocketRemoteAddress(self0 uint32, result *cm.Result[IPSocketAddressShape, network.IPSocketAddress, network.ErrorCode])
|
||||
|
||||
// SendBufferSize represents the imported method "send-buffer-size".
|
||||
//
|
||||
// send-buffer-size: func() -> result<u64, error-code>
|
||||
//
|
||||
//go:nosplit
|
||||
func (self UDPSocket) SendBufferSize() (result cm.Result[uint64, uint64, network.ErrorCode]) {
|
||||
func (self UDPSocket) SendBufferSize() (result cm.Result[uint64, uint64, ErrorCode]) {
|
||||
self0 := cm.Reinterpret[uint32](self)
|
||||
wasmimport_UDPSocketSendBufferSize((uint32)(self0), &result)
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:sockets/udp@0.2.0 [method]udp-socket.send-buffer-size
|
||||
//go:noescape
|
||||
func wasmimport_UDPSocketSendBufferSize(self0 uint32, result *cm.Result[uint64, uint64, network.ErrorCode])
|
||||
|
||||
// SetReceiveBufferSize represents the imported method "set-receive-buffer-size".
|
||||
//
|
||||
// set-receive-buffer-size: func(value: u64) -> result<_, error-code>
|
||||
//
|
||||
//go:nosplit
|
||||
func (self UDPSocket) SetReceiveBufferSize(value uint64) (result cm.Result[network.ErrorCode, struct{}, network.ErrorCode]) {
|
||||
func (self UDPSocket) SetReceiveBufferSize(value uint64) (result cm.Result[ErrorCode, struct{}, ErrorCode]) {
|
||||
self0 := cm.Reinterpret[uint32](self)
|
||||
value0 := (uint64)(value)
|
||||
wasmimport_UDPSocketSetReceiveBufferSize((uint32)(self0), (uint64)(value0), &result)
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:sockets/udp@0.2.0 [method]udp-socket.set-receive-buffer-size
|
||||
//go:noescape
|
||||
func wasmimport_UDPSocketSetReceiveBufferSize(self0 uint32, value0 uint64, result *cm.Result[network.ErrorCode, struct{}, network.ErrorCode])
|
||||
|
||||
// SetSendBufferSize represents the imported method "set-send-buffer-size".
|
||||
//
|
||||
// set-send-buffer-size: func(value: u64) -> result<_, error-code>
|
||||
//
|
||||
//go:nosplit
|
||||
func (self UDPSocket) SetSendBufferSize(value uint64) (result cm.Result[network.ErrorCode, struct{}, network.ErrorCode]) {
|
||||
func (self UDPSocket) SetSendBufferSize(value uint64) (result cm.Result[ErrorCode, struct{}, ErrorCode]) {
|
||||
self0 := cm.Reinterpret[uint32](self)
|
||||
value0 := (uint64)(value)
|
||||
wasmimport_UDPSocketSetSendBufferSize((uint32)(self0), (uint64)(value0), &result)
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:sockets/udp@0.2.0 [method]udp-socket.set-send-buffer-size
|
||||
//go:noescape
|
||||
func wasmimport_UDPSocketSetSendBufferSize(self0 uint32, value0 uint64, result *cm.Result[network.ErrorCode, struct{}, network.ErrorCode])
|
||||
|
||||
// SetUnicastHopLimit represents the imported method "set-unicast-hop-limit".
|
||||
//
|
||||
// set-unicast-hop-limit: func(value: u8) -> result<_, error-code>
|
||||
//
|
||||
//go:nosplit
|
||||
func (self UDPSocket) SetUnicastHopLimit(value uint8) (result cm.Result[network.ErrorCode, struct{}, network.ErrorCode]) {
|
||||
func (self UDPSocket) SetUnicastHopLimit(value uint8) (result cm.Result[ErrorCode, struct{}, ErrorCode]) {
|
||||
self0 := cm.Reinterpret[uint32](self)
|
||||
value0 := (uint32)(value)
|
||||
wasmimport_UDPSocketSetUnicastHopLimit((uint32)(self0), (uint32)(value0), &result)
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:sockets/udp@0.2.0 [method]udp-socket.set-unicast-hop-limit
|
||||
//go:noescape
|
||||
func wasmimport_UDPSocketSetUnicastHopLimit(self0 uint32, value0 uint32, result *cm.Result[network.ErrorCode, struct{}, network.ErrorCode])
|
||||
|
||||
// StartBind represents the imported method "start-bind".
|
||||
//
|
||||
// Bind the socket to a specific network on the provided IP address and port.
|
||||
@@ -301,7 +288,7 @@ func wasmimport_UDPSocketSetUnicastHopLimit(self0 uint32, value0 uint32, result
|
||||
// result<_, error-code>
|
||||
//
|
||||
//go:nosplit
|
||||
func (self UDPSocket) StartBind(network_ network.Network, localAddress network.IPSocketAddress) (result cm.Result[network.ErrorCode, struct{}, network.ErrorCode]) {
|
||||
func (self UDPSocket) 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)
|
||||
@@ -309,10 +296,6 @@ func (self UDPSocket) StartBind(network_ network.Network, localAddress network.I
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:sockets/udp@0.2.0 [method]udp-socket.start-bind
|
||||
//go:noescape
|
||||
func wasmimport_UDPSocketStartBind(self0 uint32, network0 uint32, localAddress0 uint32, localAddress1 uint32, localAddress2 uint32, localAddress3 uint32, localAddress4 uint32, localAddress5 uint32, localAddress6 uint32, localAddress7 uint32, localAddress8 uint32, localAddress9 uint32, localAddress10 uint32, localAddress11 uint32, result *cm.Result[network.ErrorCode, struct{}, network.ErrorCode])
|
||||
|
||||
// Stream represents the imported method "stream".
|
||||
//
|
||||
// Set up inbound & outbound communication channels, optionally to a specific peer.
|
||||
@@ -370,17 +353,13 @@ func wasmimport_UDPSocketStartBind(self0 uint32, network0 uint32, localAddress0
|
||||
// outgoing-datagram-stream>, error-code>
|
||||
//
|
||||
//go:nosplit
|
||||
func (self UDPSocket) Stream(remoteAddress cm.Option[network.IPSocketAddress]) (result cm.Result[TupleIncomingDatagramStreamOutgoingDatagramStreamShape, cm.Tuple[IncomingDatagramStream, OutgoingDatagramStream], network.ErrorCode]) {
|
||||
func (self UDPSocket) Stream(remoteAddress cm.Option[IPSocketAddress]) (result cm.Result[TupleIncomingDatagramStreamOutgoingDatagramStreamShape, cm.Tuple[IncomingDatagramStream, OutgoingDatagramStream], ErrorCode]) {
|
||||
self0 := cm.Reinterpret[uint32](self)
|
||||
remoteAddress0, remoteAddress1, remoteAddress2, remoteAddress3, remoteAddress4, remoteAddress5, remoteAddress6, remoteAddress7, remoteAddress8, remoteAddress9, remoteAddress10, remoteAddress11, remoteAddress12 := lower_OptionIPSocketAddress(remoteAddress)
|
||||
wasmimport_UDPSocketStream((uint32)(self0), (uint32)(remoteAddress0), (uint32)(remoteAddress1), (uint32)(remoteAddress2), (uint32)(remoteAddress3), (uint32)(remoteAddress4), (uint32)(remoteAddress5), (uint32)(remoteAddress6), (uint32)(remoteAddress7), (uint32)(remoteAddress8), (uint32)(remoteAddress9), (uint32)(remoteAddress10), (uint32)(remoteAddress11), (uint32)(remoteAddress12), &result)
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:sockets/udp@0.2.0 [method]udp-socket.stream
|
||||
//go:noescape
|
||||
func wasmimport_UDPSocketStream(self0 uint32, remoteAddress0 uint32, remoteAddress1 uint32, remoteAddress2 uint32, remoteAddress3 uint32, remoteAddress4 uint32, remoteAddress5 uint32, remoteAddress6 uint32, remoteAddress7 uint32, remoteAddress8 uint32, remoteAddress9 uint32, remoteAddress10 uint32, remoteAddress11 uint32, remoteAddress12 uint32, result *cm.Result[TupleIncomingDatagramStreamOutgoingDatagramStreamShape, cm.Tuple[IncomingDatagramStream, OutgoingDatagramStream], network.ErrorCode])
|
||||
|
||||
// Subscribe represents the imported method "subscribe".
|
||||
//
|
||||
// Create a `pollable` which will resolve once the socket is ready for I/O.
|
||||
@@ -391,17 +370,13 @@ func wasmimport_UDPSocketStream(self0 uint32, remoteAddress0 uint32, remoteAddre
|
||||
// subscribe: func() -> pollable
|
||||
//
|
||||
//go:nosplit
|
||||
func (self UDPSocket) Subscribe() (result poll.Pollable) {
|
||||
func (self UDPSocket) Subscribe() (result Pollable) {
|
||||
self0 := cm.Reinterpret[uint32](self)
|
||||
result0 := wasmimport_UDPSocketSubscribe((uint32)(self0))
|
||||
result = cm.Reinterpret[poll.Pollable]((uint32)(result0))
|
||||
result = cm.Reinterpret[Pollable]((uint32)(result0))
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:sockets/udp@0.2.0 [method]udp-socket.subscribe
|
||||
//go:noescape
|
||||
func wasmimport_UDPSocketSubscribe(self0 uint32) (result0 uint32)
|
||||
|
||||
// UnicastHopLimit represents the imported method "unicast-hop-limit".
|
||||
//
|
||||
// Equivalent to the IP_TTL & IPV6_UNICAST_HOPS socket options.
|
||||
@@ -414,16 +389,12 @@ func wasmimport_UDPSocketSubscribe(self0 uint32) (result0 uint32)
|
||||
// unicast-hop-limit: func() -> result<u8, error-code>
|
||||
//
|
||||
//go:nosplit
|
||||
func (self UDPSocket) UnicastHopLimit() (result cm.Result[uint8, uint8, network.ErrorCode]) {
|
||||
func (self UDPSocket) UnicastHopLimit() (result cm.Result[uint8, uint8, ErrorCode]) {
|
||||
self0 := cm.Reinterpret[uint32](self)
|
||||
wasmimport_UDPSocketUnicastHopLimit((uint32)(self0), &result)
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:sockets/udp@0.2.0 [method]udp-socket.unicast-hop-limit
|
||||
//go:noescape
|
||||
func wasmimport_UDPSocketUnicastHopLimit(self0 uint32, result *cm.Result[uint8, uint8, network.ErrorCode])
|
||||
|
||||
// IncomingDatagramStream represents the imported resource "wasi:sockets/udp@0.2.0#incoming-datagram-stream".
|
||||
//
|
||||
// resource incoming-datagram-stream
|
||||
@@ -440,10 +411,6 @@ func (self IncomingDatagramStream) ResourceDrop() {
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:sockets/udp@0.2.0 [resource-drop]incoming-datagram-stream
|
||||
//go:noescape
|
||||
func wasmimport_IncomingDatagramStreamResourceDrop(self0 uint32)
|
||||
|
||||
// Receive represents the imported method "receive".
|
||||
//
|
||||
// Receive messages on the socket.
|
||||
@@ -475,17 +442,13 @@ func wasmimport_IncomingDatagramStreamResourceDrop(self0 uint32)
|
||||
// receive: func(max-results: u64) -> result<list<incoming-datagram>, error-code>
|
||||
//
|
||||
//go:nosplit
|
||||
func (self IncomingDatagramStream) Receive(maxResults uint64) (result cm.Result[cm.List[IncomingDatagram], cm.List[IncomingDatagram], network.ErrorCode]) {
|
||||
func (self IncomingDatagramStream) Receive(maxResults uint64) (result cm.Result[cm.List[IncomingDatagram], cm.List[IncomingDatagram], ErrorCode]) {
|
||||
self0 := cm.Reinterpret[uint32](self)
|
||||
maxResults0 := (uint64)(maxResults)
|
||||
wasmimport_IncomingDatagramStreamReceive((uint32)(self0), (uint64)(maxResults0), &result)
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:sockets/udp@0.2.0 [method]incoming-datagram-stream.receive
|
||||
//go:noescape
|
||||
func wasmimport_IncomingDatagramStreamReceive(self0 uint32, maxResults0 uint64, result *cm.Result[cm.List[IncomingDatagram], cm.List[IncomingDatagram], network.ErrorCode])
|
||||
|
||||
// Subscribe represents the imported method "subscribe".
|
||||
//
|
||||
// Create a `pollable` which will resolve once the stream is ready to receive again.
|
||||
@@ -496,17 +459,13 @@ func wasmimport_IncomingDatagramStreamReceive(self0 uint32, maxResults0 uint64,
|
||||
// subscribe: func() -> pollable
|
||||
//
|
||||
//go:nosplit
|
||||
func (self IncomingDatagramStream) Subscribe() (result poll.Pollable) {
|
||||
func (self IncomingDatagramStream) Subscribe() (result Pollable) {
|
||||
self0 := cm.Reinterpret[uint32](self)
|
||||
result0 := wasmimport_IncomingDatagramStreamSubscribe((uint32)(self0))
|
||||
result = cm.Reinterpret[poll.Pollable]((uint32)(result0))
|
||||
result = cm.Reinterpret[Pollable]((uint32)(result0))
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:sockets/udp@0.2.0 [method]incoming-datagram-stream.subscribe
|
||||
//go:noescape
|
||||
func wasmimport_IncomingDatagramStreamSubscribe(self0 uint32) (result0 uint32)
|
||||
|
||||
// OutgoingDatagramStream represents the imported resource "wasi:sockets/udp@0.2.0#outgoing-datagram-stream".
|
||||
//
|
||||
// resource outgoing-datagram-stream
|
||||
@@ -523,10 +482,6 @@ func (self OutgoingDatagramStream) ResourceDrop() {
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:sockets/udp@0.2.0 [resource-drop]outgoing-datagram-stream
|
||||
//go:noescape
|
||||
func wasmimport_OutgoingDatagramStreamResourceDrop(self0 uint32)
|
||||
|
||||
// CheckSend represents the imported method "check-send".
|
||||
//
|
||||
// Check readiness for sending. This function never blocks.
|
||||
@@ -544,16 +499,12 @@ func wasmimport_OutgoingDatagramStreamResourceDrop(self0 uint32)
|
||||
// check-send: func() -> result<u64, error-code>
|
||||
//
|
||||
//go:nosplit
|
||||
func (self OutgoingDatagramStream) CheckSend() (result cm.Result[uint64, uint64, network.ErrorCode]) {
|
||||
func (self OutgoingDatagramStream) CheckSend() (result cm.Result[uint64, uint64, ErrorCode]) {
|
||||
self0 := cm.Reinterpret[uint32](self)
|
||||
wasmimport_OutgoingDatagramStreamCheckSend((uint32)(self0), &result)
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:sockets/udp@0.2.0 [method]outgoing-datagram-stream.check-send
|
||||
//go:noescape
|
||||
func wasmimport_OutgoingDatagramStreamCheckSend(self0 uint32, result *cm.Result[uint64, uint64, network.ErrorCode])
|
||||
|
||||
// Send represents the imported method "send".
|
||||
//
|
||||
// Send messages on the socket.
|
||||
@@ -608,17 +559,13 @@ func wasmimport_OutgoingDatagramStreamCheckSend(self0 uint32, result *cm.Result[
|
||||
// send: func(datagrams: list<outgoing-datagram>) -> result<u64, error-code>
|
||||
//
|
||||
//go:nosplit
|
||||
func (self OutgoingDatagramStream) Send(datagrams cm.List[OutgoingDatagram]) (result cm.Result[uint64, uint64, network.ErrorCode]) {
|
||||
func (self OutgoingDatagramStream) Send(datagrams cm.List[OutgoingDatagram]) (result cm.Result[uint64, uint64, ErrorCode]) {
|
||||
self0 := cm.Reinterpret[uint32](self)
|
||||
datagrams0, datagrams1 := cm.LowerList(datagrams)
|
||||
wasmimport_OutgoingDatagramStreamSend((uint32)(self0), (*OutgoingDatagram)(datagrams0), (uint32)(datagrams1), &result)
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:sockets/udp@0.2.0 [method]outgoing-datagram-stream.send
|
||||
//go:noescape
|
||||
func wasmimport_OutgoingDatagramStreamSend(self0 uint32, datagrams0 *OutgoingDatagram, datagrams1 uint32, result *cm.Result[uint64, uint64, network.ErrorCode])
|
||||
|
||||
// Subscribe represents the imported method "subscribe".
|
||||
//
|
||||
// Create a `pollable` which will resolve once the stream is ready to send again.
|
||||
@@ -629,13 +576,9 @@ func wasmimport_OutgoingDatagramStreamSend(self0 uint32, datagrams0 *OutgoingDat
|
||||
// subscribe: func() -> pollable
|
||||
//
|
||||
//go:nosplit
|
||||
func (self OutgoingDatagramStream) Subscribe() (result poll.Pollable) {
|
||||
func (self OutgoingDatagramStream) Subscribe() (result Pollable) {
|
||||
self0 := cm.Reinterpret[uint32](self)
|
||||
result0 := wasmimport_OutgoingDatagramStreamSubscribe((uint32)(self0))
|
||||
result = cm.Reinterpret[poll.Pollable]((uint32)(result0))
|
||||
result = cm.Reinterpret[Pollable]((uint32)(result0))
|
||||
return
|
||||
}
|
||||
|
||||
//go:wasmimport wasi:sockets/udp@0.2.0 [method]outgoing-datagram-stream.subscribe
|
||||
//go:noescape
|
||||
func wasmimport_OutgoingDatagramStreamSubscribe(self0 uint32) (result0 uint32)
|
||||
|
||||
Reference in New Issue
Block a user