types

package
v0.19.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 7, 2023 License: MIT Imports: 12 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrorStrings is a global used in the formatting of Errno values.
	//
	// The table is empty by default, but the program may assign a table indexed
	// by error code to customize the error messages.
	//
	// There is no synchronization so it is recommended to assign this global
	// during program initialization (e.g. in an init function).
	ErrorStrings []string
)

Functions

func Format added in v0.16.0

func Format(w io.Writer, v any)

Format is a helper function which can be used in the implementation of the FormatValue and FormatObject methods of Value and Object[T].

The code below represents a common usage pattern:

func (v T) FormatObject(w io.Writer, memory api.Memory, object []byte) {
	types.Format(w, v.LoadObject(memory, object))
}

If T is a struct type, the output is wrapped in "{...}" and the struct fields are iterated and printed as comma-separated "name:value" pairs. The name may be customized by defining a "name" struct field tag such as:

type T struct {
	Field int32 `name:"field"`
}

If any of the values impelement the Formatter or fmt.Stringer interfaces, formatting is delegated to those methods.

The implementation of Format has to use reflection, so it may not be best suited to use in contexts where performance is critical, in which cases the program is better off providing a custom implementation of the method.

func UnsafeLoadObject added in v0.16.0

func UnsafeLoadObject[T Object[T]](mem []byte) T

UnsafeLoadObject is a helper which may be used to implement the LoadObject method for object types which do not contain any inner pointers.

func (v T) LoadObject(_ api.Memory, object []byte) T {
	return types.UnsafeLoadObject[T](object)
}

func UnsafeStoreObject added in v0.16.0

func UnsafeStoreObject[T Object[T]](mem []byte, obj T)

UnsafeStoreObject is a helper which may be used to implement the StoreObject method for object types which do not contain any inner pointers.

func (v T) StoreObject(_ api.Memory, object []byte) {
	types.UnsafeStoreObject(object, v)
}

Types

type Array

type Array[T primitive] []T

Array is a type representing a sequence of contiguous items in memory. Array values are composed of a pair of pointer and number of items. The item size is determined by the size of the type T.

Arrays only satisfy the Param interface, they cannot be used as return value of functions.

At this time, arrays may only be composed of primitive Go types, but this restriction may be relaxed in a future version. Use List to laod sequences of complex types.

func (Array[T]) Format added in v0.17.0

func (arg Array[T]) Format(w io.Writer)

func (Array[T]) FormatObject

func (arg Array[T]) FormatObject(w io.Writer, memory api.Memory, object []byte)

func (Array[T]) FormatValue

func (arg Array[T]) FormatValue(w io.Writer, memory api.Memory, stack []uint64)

func (Array[T]) LoadObject

func (arg Array[T]) LoadObject(memory api.Memory, object []byte) Array[T]

func (Array[T]) LoadValue

func (arg Array[T]) LoadValue(memory api.Memory, stack []uint64) Array[T]

func (Array[T]) ObjectSize

func (arg Array[T]) ObjectSize() int

func (Array[T]) StoreObject

func (arg Array[T]) StoreObject(memory api.Memory, object []byte)

func (Array[T]) ValueTypes

func (arg Array[T]) ValueTypes() []api.ValueType

type Bool added in v0.4.0

type Bool bool

func (Bool) Format added in v0.17.0

func (arg Bool) Format(w io.Writer)

func (Bool) FormatObject added in v0.4.0

func (arg Bool) FormatObject(w io.Writer, memory api.Memory, object []byte)

func (Bool) FormatValue added in v0.4.0

func (arg Bool) FormatValue(w io.Writer, memory api.Memory, stack []uint64)

func (Bool) LoadObject added in v0.4.0

func (arg Bool) LoadObject(memory api.Memory, object []byte) Bool

func (Bool) LoadValue added in v0.4.0

func (arg Bool) LoadValue(memory api.Memory, stack []uint64) Bool

func (Bool) ObjectSize added in v0.4.0

func (arg Bool) ObjectSize() int

func (Bool) StoreObject added in v0.4.0

func (arg Bool) StoreObject(memory api.Memory, object []byte)

func (Bool) StoreValue added in v0.4.0

func (arg Bool) StoreValue(memory api.Memory, stack []uint64)

func (Bool) ValueTypes added in v0.4.0

func (arg Bool) ValueTypes() []api.ValueType

type Bytes

type Bytes Array[byte]

Bytes is a type alias for arrays of bytes, which is a common use case (e.g. I/O functions working on a byte buffer).

func (Bytes) Format

func (arg Bytes) Format(w io.Writer)

func (Bytes) FormatObject

func (arg Bytes) FormatObject(w io.Writer, memory api.Memory, object []byte)

func (Bytes) FormatValue

func (arg Bytes) FormatValue(w io.Writer, memory api.Memory, stack []uint64)

func (Bytes) LoadObject

func (arg Bytes) LoadObject(memory api.Memory, object []byte) Bytes

func (Bytes) LoadValue

func (arg Bytes) LoadValue(memory api.Memory, stack []uint64) Bytes

func (Bytes) ObjectSize

func (arg Bytes) ObjectSize() int

func (Bytes) StoreObject

func (arg Bytes) StoreObject(memory api.Memory, object []byte)

func (Bytes) ValueTypes

func (arg Bytes) ValueTypes() []api.ValueType

type Duration added in v0.10.0

type Duration time.Duration

func (Duration) Format added in v0.17.0

func (arg Duration) Format(w io.Writer)

func (Duration) FormatObject added in v0.10.0

func (arg Duration) FormatObject(w io.Writer, memory api.Memory, object []byte)

func (Duration) FormatValue added in v0.10.0

func (arg Duration) FormatValue(w io.Writer, memory api.Memory, stack []uint64)

func (Duration) LoadObject added in v0.10.0

func (arg Duration) LoadObject(memory api.Memory, object []byte) Duration

func (Duration) LoadValue added in v0.10.0

func (arg Duration) LoadValue(memory api.Memory, stack []uint64) Duration

func (Duration) ObjectSize added in v0.10.0

func (arg Duration) ObjectSize() int

func (Duration) StoreObject added in v0.10.0

func (arg Duration) StoreObject(memory api.Memory, object []byte)

func (Duration) StoreValue added in v0.10.0

func (arg Duration) StoreValue(memory api.Memory, stack []uint64)

func (Duration) ValueTypes added in v0.10.0

func (arg Duration) ValueTypes() []api.ValueType

type Errno

type Errno int32

Errno is an error type representing error codes that are often returned by WebAssembly module functions.

This type is employed when converting Go errors embedded into optional values to WebAssembly error codes. Go errors are converted to Errno values by unwrapping and inspecting the values to determine their error code. If a Go error has an Errno method, it is called to be converted to an Errno value.

The special value 0 always indicates that there were no errors, similarly to how a Go program would treat a nil error.

func AsErrno added in v0.18.0

func AsErrno(err error) Errno

func (Errno) Errno

func (err Errno) Errno() int32

Errno returns err as an int32 value.

func (Errno) Error

func (err Errno) Error() string

Error returns a human readable representation of err.

func (Errno) FormatValue added in v0.11.0

func (err Errno) FormatValue(w io.Writer, memory api.Memory, stack []uint64)

func (Errno) LoadValue added in v0.11.0

func (err Errno) LoadValue(memory api.Memory, stack []uint64) Errno

func (Errno) StoreValue added in v0.11.0

func (err Errno) StoreValue(memory api.Memory, stack []uint64)

func (Errno) ValueTypes added in v0.11.0

func (err Errno) ValueTypes() []api.ValueType

type Error

type Error = Optional[None]

Error is a special optional type which either contains an error or no values. It is useful to represent return values of functions that may error but do not return any other values.

func Fail

func Fail(err error) Error

Fail constructs an Error value from the given Go error. The function panics if err is nil.

type Float32

type Float32 float32

func (Float32) Format added in v0.17.0

func (arg Float32) Format(w io.Writer)

func (Float32) FormatObject

func (arg Float32) FormatObject(w io.Writer, memory api.Memory, object []byte)

func (Float32) FormatValue

func (arg Float32) FormatValue(w io.Writer, memory api.Memory, stack []uint64)

func (Float32) LoadObject

func (arg Float32) LoadObject(memory api.Memory, object []byte) Float32

func (Float32) LoadValue

func (arg Float32) LoadValue(memory api.Memory, stack []uint64) Float32

func (Float32) ObjectSize

func (arg Float32) ObjectSize() int

func (Float32) StoreObject

func (arg Float32) StoreObject(memory api.Memory, object []byte)

func (Float32) StoreValue

func (arg Float32) StoreValue(memory api.Memory, stack []uint64)

func (Float32) ValueTypes

func (arg Float32) ValueTypes() []api.ValueType

type Float64

type Float64 float64

func (Float64) Format added in v0.17.0

func (arg Float64) Format(w io.Writer)

func (Float64) FormatObject

func (arg Float64) FormatObject(w io.Writer, memory api.Memory, object []byte)

func (Float64) FormatValue

func (arg Float64) FormatValue(w io.Writer, memory api.Memory, stack []uint64)

func (Float64) LoadObject

func (arg Float64) LoadObject(memory api.Memory, object []byte) Float64

func (Float64) LoadValue

func (arg Float64) LoadValue(memory api.Memory, stack []uint64) Float64

func (Float64) ObjectSize

func (arg Float64) ObjectSize() int

func (Float64) StoreObject

func (arg Float64) StoreObject(memory api.Memory, object []byte)

func (Float64) StoreValue

func (arg Float64) StoreValue(memory api.Memory, stack []uint64)

func (Float64) ValueTypes

func (arg Float64) ValueTypes() []api.ValueType

type Formatter added in v0.16.0

type Formatter interface {
	Format(io.Writer)
}

Formatter is an interface used to customize the behavior of Format.

type Int16

type Int16 int16

func (Int16) Format added in v0.17.0

func (arg Int16) Format(w io.Writer)

func (Int16) FormatObject

func (arg Int16) FormatObject(w io.Writer, memory api.Memory, object []byte)

func (Int16) FormatValue

func (arg Int16) FormatValue(w io.Writer, memory api.Memory, stack []uint64)

func (Int16) LoadObject

func (arg Int16) LoadObject(memory api.Memory, object []byte) Int16

func (Int16) LoadValue

func (arg Int16) LoadValue(memory api.Memory, stack []uint64) Int16

func (Int16) ObjectSize

func (arg Int16) ObjectSize() int

func (Int16) StoreObject

func (arg Int16) StoreObject(memory api.Memory, object []byte)

func (Int16) StoreValue

func (arg Int16) StoreValue(memory api.Memory, stack []uint64)

func (Int16) ValueTypes

func (arg Int16) ValueTypes() []api.ValueType

type Int32

type Int32 int32

func (Int32) Format added in v0.17.0

func (arg Int32) Format(w io.Writer)

func (Int32) FormatObject

func (arg Int32) FormatObject(w io.Writer, memory api.Memory, object []byte)

func (Int32) FormatValue

func (arg Int32) FormatValue(w io.Writer, memory api.Memory, stack []uint64)

func (Int32) LoadObject

func (arg Int32) LoadObject(memory api.Memory, object []byte) Int32

func (Int32) LoadValue

func (arg Int32) LoadValue(memory api.Memory, stack []uint64) Int32

func (Int32) ObjectSize

func (arg Int32) ObjectSize() int

func (Int32) StoreObject

func (arg Int32) StoreObject(memory api.Memory, object []byte)

func (Int32) StoreValue

func (arg Int32) StoreValue(memory api.Memory, stack []uint64)

func (Int32) ValueTypes

func (arg Int32) ValueTypes() []api.ValueType

type Int64

type Int64 int64

func (Int64) Format added in v0.17.0

func (arg Int64) Format(w io.Writer)

func (Int64) FormatObject

func (arg Int64) FormatObject(w io.Writer, memory api.Memory, object []byte)

func (Int64) FormatValue

func (arg Int64) FormatValue(w io.Writer, memory api.Memory, stack []uint64)

func (Int64) LoadObject

func (arg Int64) LoadObject(memory api.Memory, object []byte) Int64

func (Int64) LoadValue

func (arg Int64) LoadValue(memory api.Memory, stack []uint64) Int64

func (Int64) ObjectSize

func (arg Int64) ObjectSize() int

func (Int64) StoreObject

func (arg Int64) StoreObject(memory api.Memory, object []byte)

func (Int64) StoreValue

func (arg Int64) StoreValue(memory api.Memory, stack []uint64)

func (Int64) ValueTypes

func (arg Int64) ValueTypes() []api.ValueType

type Int8

type Int8 int8

func (Int8) Format added in v0.17.0

func (arg Int8) Format(w io.Writer)

func (Int8) FormatObject

func (arg Int8) FormatObject(w io.Writer, memory api.Memory, object []byte)

func (Int8) FormatValue

func (arg Int8) FormatValue(w io.Writer, memory api.Memory, stack []uint64)

func (Int8) LoadObject

func (arg Int8) LoadObject(memory api.Memory, object []byte) Int8

func (Int8) LoadValue

func (arg Int8) LoadValue(memory api.Memory, stack []uint64) Int8

func (Int8) ObjectSize

func (arg Int8) ObjectSize() int

func (Int8) StoreObject

func (arg Int8) StoreObject(memory api.Memory, object []byte)

func (Int8) StoreValue

func (arg Int8) StoreValue(memory api.Memory, stack []uint64)

func (Int8) ValueTypes

func (arg Int8) ValueTypes() []api.ValueType

type List

type List[T Object[T]] struct {
	// contains filtered or unexported fields
}

List represents a sequence of objects held in module memory.

func MakeList added in v0.13.0

func MakeList[T Object[T]](ptr Pointer[T], length int) List[T]

MakeList constructs a list from a pointer to an object of type T and a length.

func (List[T]) Append added in v0.16.0

func (arg List[T]) Append(buffer []T) []T

func (List[T]) FormatValue

func (arg List[T]) FormatValue(w io.Writer, memory api.Memory, stack []uint64)

func (List[T]) Index

func (arg List[T]) Index(index int) Pointer[T]

func (List[T]) Len

func (arg List[T]) Len() int

func (List[T]) LoadValue

func (arg List[T]) LoadValue(memory api.Memory, stack []uint64) List[T]

func (List[T]) Range

func (arg List[T]) Range(fn func(int, T) bool)

func (List[T]) Slice added in v0.16.0

func (arg List[T]) Slice() []T

func (List[T]) UnsafeSlice added in v0.16.0

func (arg List[T]) UnsafeSlice() []T

func (List[T]) ValueTypes

func (arg List[T]) ValueTypes() []api.ValueType

type None

type None struct{}

None is a special type of size zero bytes.

func (None) Format added in v0.17.0

func (None) Format(w io.Writer)

func (None) FormatObject

func (None) FormatObject(w io.Writer, _ api.Memory, _ []byte)

func (None) FormatValue

func (None) FormatValue(w io.Writer, _ api.Memory, _ []uint64)

func (None) LoadObject

func (None) LoadObject(api.Memory, []byte) (none None)

func (None) LoadValue

func (None) LoadValue(api.Memory, []uint64) (none None)

func (None) ObjectSize

func (None) ObjectSize() int

func (None) StoreObject

func (None) StoreObject(api.Memory, []byte)

func (None) StoreValue

func (None) StoreValue(api.Memory, []uint64)

func (None) ValueTypes

func (None) ValueTypes() []api.ValueType

type Object

type Object[T any] interface {
	// Writes a human-readable representation of the object to w.
	FormatObject(w io.Writer, memory api.Memory, object []byte)
	// Loads and returns the object from the given byte slice. If the object
	// contains pointers it migh read them from the module memory passed as
	// first argument.
	LoadObject(memory api.Memory, object []byte) T
	// Stores the object to the given tye slice. If the object contains pointers
	// it might write them to the module memory passed as first argument (doing
	// so without writing to arbitrary location is difficult so this use case is
	// rather rare).
	StoreObject(memory api.Memory, object []byte)
	// Returns the size of the the object in bytes. The byte slices passed to
	// LoadObject and StoreObjects are guaranteed to be at least of the length
	// returned by this method.
	ObjectSize() int
}

Object is an interface which represents values that can be loaded or stored in memory.

The interface is mainly used as a constraint for generic type parameters.

type Optional

type Optional[T ParamResult[T]] struct {
	// contains filtered or unexported fields
}

Optional represents a function result which may be missing due to the program encountering an error. The type contains either a value of type T or an error.

var OK Optional[None]

OK is a special value indicating that a function which returns nothing has not errored either.

func Err

func Err[T ParamResult[T]](err error) Optional[T]

Err constructs an optional from an error. The function panics if the error is nil since a nil error indicates that the optional should contain a value.

func Opt

func Opt[T ParamResult[T]](res T, err error) Optional[T]

Opt constructs an optional from a pair of a result and error.

func Res

func Res[T ParamResult[T]](res T) Optional[T]

Res constructs an optional from a value.

func (Optional[T]) Error

func (opt Optional[T]) Error() error

Error returns the error embedded in opt, or nil if opt contains a value.

func (Optional[T]) FormatValue

func (opt Optional[T]) FormatValue(w io.Writer, memory api.Memory, stack []uint64)

func (Optional[T]) LoadValue

func (opt Optional[T]) LoadValue(memory api.Memory, stack []uint64) Optional[T]

func (Optional[T]) Result

func (opt Optional[T]) Result() T

Value returns the underlying value of the optional. The method panics if opt contained an error.

func (Optional[T]) StoreValue

func (opt Optional[T]) StoreValue(memory api.Memory, stack []uint64)

func (Optional[T]) ValueTypes

func (opt Optional[T]) ValueTypes() []api.ValueType

type Param

type Param[T any] interface {
	Value
	// Loads and returns the parameter value from the stack and optionally
	// reading its content from memory.
	LoadValue(memory api.Memory, stack []uint64) T
}

Param is an interface representing parameters of WebAssembly functions which are read form the stack.

The interface is mainly used as a constraint for generic type parameters.

type ParamResult

type ParamResult[T any] interface {
	Param[T]
	Result
}

ParamResult is an interface implemented by types which can be used as both a parameter and a result.

type Pointer

type Pointer[T Object[T]] struct {
	// contains filtered or unexported fields
}

Pointer is a parameter type used to represent a pointer to an object held in program memory.

func New

func New[T Object[T]]() Pointer[T]

New constructs a pointer to an object of type T backed by Go memory.

This function is mostly useful to construct pointers to pass to module methods in tests, its usage in actual production code should be rare.

func Ptr

func Ptr[T Object[T]](memory api.Memory, offset uint32) Pointer[T]

Ptr constructs a pointer of objects T backed by a memory area at a specified offset.

This function is mostly useful to construct pointers to pass to module methods in tests, its usage in actual production code should be rare.

func (Pointer[T]) Append added in v0.16.0

func (arg Pointer[T]) Append(buffer []T, count int) []T

func (Pointer[T]) FormatObject added in v0.19.1

func (arg Pointer[T]) FormatObject(w io.Writer, memory api.Memory, object []byte)

func (Pointer[T]) FormatValue

func (arg Pointer[T]) FormatValue(w io.Writer, memory api.Memory, stack []uint64)

func (Pointer[T]) Index

func (arg Pointer[T]) Index(index int) Pointer[T]

func (Pointer[T]) Load

func (arg Pointer[T]) Load() (value T)

func (Pointer[T]) LoadObject added in v0.19.1

func (arg Pointer[T]) LoadObject(memory api.Memory, object []byte) Pointer[T]

func (Pointer[T]) LoadValue

func (arg Pointer[T]) LoadValue(memory api.Memory, stack []uint64) Pointer[T]

func (Pointer[T]) Memory

func (arg Pointer[T]) Memory() api.Memory

func (Pointer[T]) Object

func (arg Pointer[T]) Object() []byte

func (Pointer[T]) ObjectSize added in v0.19.1

func (arg Pointer[T]) ObjectSize() int

func (Pointer[T]) Offset

func (arg Pointer[T]) Offset() uint32

func (Pointer[T]) Slice added in v0.16.0

func (arg Pointer[T]) Slice(count int) []T

func (Pointer[T]) Store

func (arg Pointer[T]) Store(value T)

func (Pointer[T]) StoreObject added in v0.19.1

func (arg Pointer[T]) StoreObject(memory api.Memory, object []byte)

func (Pointer[T]) UnsafeSlice added in v0.16.0

func (arg Pointer[T]) UnsafeSlice(count int) []T

func (Pointer[T]) ValueTypes

func (arg Pointer[T]) ValueTypes() []api.ValueType

type Result

type Result interface {
	Value
	// Stores the result value onto the stack and optionally writing its
	// content to memory.
	StoreValue(memory api.Memory, stack []uint64)
}

Result is an interface reprenting results of WebAssembly functions which are written to the stack.

The interface is mainly used as a constraint for generic type parameters.

type String

type String string

String is similar to Bytes but holds the value as a Go string which is not sharing memory with the WebAssembly program memory anymore.

func (String) Format added in v0.17.0

func (arg String) Format(w io.Writer)

func (String) FormatValue

func (arg String) FormatValue(w io.Writer, memory api.Memory, stack []uint64)

func (String) LoadValue

func (arg String) LoadValue(memory api.Memory, stack []uint64) String

func (String) ValueTypes

func (arg String) ValueTypes() []api.ValueType

type Uint16

type Uint16 uint16

func (Uint16) Format added in v0.17.0

func (arg Uint16) Format(w io.Writer)

func (Uint16) FormatObject

func (arg Uint16) FormatObject(w io.Writer, memory api.Memory, object []byte)

func (Uint16) FormatValue

func (arg Uint16) FormatValue(w io.Writer, memory api.Memory, stack []uint64)

func (Uint16) LoadObject

func (arg Uint16) LoadObject(memory api.Memory, object []byte) Uint16

func (Uint16) LoadValue

func (arg Uint16) LoadValue(memory api.Memory, stack []uint64) Uint16

func (Uint16) ObjectSize

func (arg Uint16) ObjectSize() int

func (Uint16) StoreObject

func (arg Uint16) StoreObject(memory api.Memory, object []byte)

func (Uint16) StoreValue

func (arg Uint16) StoreValue(memory api.Memory, stack []uint64)

func (Uint16) ValueTypes

func (arg Uint16) ValueTypes() []api.ValueType

type Uint32

type Uint32 uint32

func (Uint32) Format added in v0.17.0

func (arg Uint32) Format(w io.Writer)

func (Uint32) FormatObject

func (arg Uint32) FormatObject(w io.Writer, memory api.Memory, object []byte)

func (Uint32) FormatValue

func (arg Uint32) FormatValue(w io.Writer, memory api.Memory, stack []uint64)

func (Uint32) LoadObject

func (arg Uint32) LoadObject(memory api.Memory, object []byte) Uint32

func (Uint32) LoadValue

func (arg Uint32) LoadValue(memory api.Memory, stack []uint64) Uint32

func (Uint32) ObjectSize

func (arg Uint32) ObjectSize() int

func (Uint32) StoreObject

func (arg Uint32) StoreObject(memory api.Memory, object []byte)

func (Uint32) StoreValue

func (arg Uint32) StoreValue(memory api.Memory, stack []uint64)

func (Uint32) ValueTypes

func (arg Uint32) ValueTypes() []api.ValueType

type Uint64

type Uint64 uint64

func (Uint64) Format added in v0.17.0

func (arg Uint64) Format(w io.Writer)

func (Uint64) FormatObject

func (arg Uint64) FormatObject(w io.Writer, memory api.Memory, object []byte)

func (Uint64) FormatValue

func (arg Uint64) FormatValue(w io.Writer, memory api.Memory, stack []uint64)

func (Uint64) LoadObject

func (arg Uint64) LoadObject(memory api.Memory, object []byte) Uint64

func (Uint64) LoadValue

func (arg Uint64) LoadValue(memory api.Memory, stack []uint64) Uint64

func (Uint64) ObjectSize

func (arg Uint64) ObjectSize() int

func (Uint64) StoreObject

func (arg Uint64) StoreObject(memory api.Memory, object []byte)

func (Uint64) StoreValue

func (arg Uint64) StoreValue(memory api.Memory, stack []uint64)

func (Uint64) ValueTypes

func (arg Uint64) ValueTypes() []api.ValueType

type Uint8

type Uint8 uint8

func (Uint8) Format added in v0.17.0

func (arg Uint8) Format(w io.Writer)

func (Uint8) FormatObject

func (arg Uint8) FormatObject(w io.Writer, memory api.Memory, object []byte)

func (Uint8) FormatValue

func (arg Uint8) FormatValue(w io.Writer, memory api.Memory, stack []uint64)

func (Uint8) LoadObject

func (arg Uint8) LoadObject(memory api.Memory, object []byte) Uint8

func (Uint8) LoadValue

func (arg Uint8) LoadValue(memory api.Memory, stack []uint64) Uint8

func (Uint8) ObjectSize

func (arg Uint8) ObjectSize() int

func (Uint8) StoreObject

func (arg Uint8) StoreObject(memory api.Memory, object []byte)

func (Uint8) StoreValue

func (arg Uint8) StoreValue(memory api.Memory, stack []uint64)

func (Uint8) ValueTypes

func (arg Uint8) ValueTypes() []api.ValueType

type Value

type Value interface {
	// Writes a human-readable representation of the field to w, using the
	// memory and stack of a program to locate the field value.
	FormatValue(w io.Writer, memory api.Memory, stack []uint64)
	// Returns the sequence of primitive types that the result value is
	// composed of. Values of primitive types will have a single type,
	// but more complex types will have more (e.g. a buffer may hold two
	// 32 bits integers for the pointer and length). The number of types
	// indicates the number of words that are consumed from the stack when
	// loading the parameter.
	ValueTypes() []api.ValueType
}

Value represents a field in a function signature, which may be a parameter or a result.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL