mem

package
v0.0.0-...-b7b0d94 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BytesToPtr

func BytesToPtr(b []byte) (uint32, uint32)

BytesToPtr returns a pointer and size pair for the given byte slice in a way compatible with WebAssembly numeric types. The returned pointer aliases the slice hence it must be kept alive until ptr is no longer needed.

func GetString

func GetString(fn func(ptr uint32, limit BufLimit) (len uint32)) string

func SendAndGetUint64

func SendAndGetUint64(input_ptr uint32, input_size uint32, fn func(input_ptr, input_size, ptr uint32, limit BufLimit)) uint64

func StringToPtr

func StringToPtr(s string) (uint32, uint32)

StringToPtr returns a pointer and size pair for the given string in a way compatible with WebAssembly numeric types. The returned pointer aliases the string hence it must be kept alive until ptr is no longer needed.

func Update

func Update(
	fn func(ptr uint32, limit BufLimit) (len uint32),
	updater func([]byte) error,
) error

Update is for decoding values from memory. The updater doesn't keep a reference to the underlying bytes, so we don't need to copy them.

Types

type BufLimit

type BufLimit = uint32

BufLimit is the possibly zero maximum length of a result value to write in bytes. If the actual value is larger than this, nothing is written to memory.

Jump to

Keyboard shortcuts

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