Help us shape the future of Go! Take the 2026 Go Developer Survey

bridge

package
v1.25.0 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const ALLOC_FUNC = "zk_alloc"
View Source
const FREE_FUNC = "zk_free"
View Source
const MEMORY_PAGE_LIMIT = 256

Variables

This section is empty.

Functions

func InvokeStatus

func InvokeStatus(name string, parts ...Arg) error

InvokeStatus is invoke for exports that return only a status code.

func InvokeWith

func InvokeWith[T any, PT decoder[T]](name string, parts ...Arg) (T, error)

InvokeWith calls the named export and decodes its result into a T. UnmarshalBinary must copy: the result buffer is scrubbed after decoding.

Types

type Arg

type Arg interface {
	MarshalBinary() ([]byte, error)
}

Arg is a value that can cross into a wasm call

type Bytes

type Bytes []byte

Bytes marshals an already-serialized buffer. MarshalBinary copies, so the scrub after the guest write cannot reach the caller's slice.

func (Bytes) MarshalBinary

func (b Bytes) MarshalBinary() ([]byte, error)

type Scalar

type Scalar uint64

Scalar is an integer passed directly as a wasm argument, and the decoded form of an 8-byte little-endian result. Use U64s for a u64 sequence that crosses as a buffer.

func (Scalar) MarshalBinary

func (s Scalar) MarshalBinary() ([]byte, error)

MarshalBinary makes Scalar an Arg. A Scalar is never marshaled: it is passed as an integer argument, so reaching here is a misuse.

func (*Scalar) UnmarshalBinary

func (s *Scalar) UnmarshalBinary(b []byte) error

type Slice

type Slice[E encoding.BinaryMarshaler] []E

Slice marshals as the concatenation of its elements' marshalings.

func (Slice[E]) MarshalBinary

func (s Slice[E]) MarshalBinary() ([]byte, error)

type U64s

type U64s []uint64

func (U64s) MarshalBinary

func (s U64s) MarshalBinary() ([]byte, error)

Jump to

Keyboard shortcuts

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