parity

package
v2.17.2 Latest Latest
Warning

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

Go to latest
Published: May 28, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

This file is a byte-identical copy of pkg/wasm/wasm-runtime/runtime/codec.go used by codec_parity_test.go to validate that the server-side stub in pkg/wasm/stubs.go and the WASM-side runtime stay in sync. Any change to runtime/codec.go MUST be mirrored here AND in stubs.go.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HexDecode

func HexDecode(s string) []byte

func HexEncode

func HexEncode(src []byte) string

Types

type Decoder

type Decoder struct {
	Buf []byte
	Pos int
	Err error
}

Decoder reads a little-endian binary stream. Err accumulates the first decode error — check it once at the end rather than per call.

func (*Decoder) Bool

func (d *Decoder) Bool() bool

func (*Decoder) Bytes

func (d *Decoder) Bytes() []byte

func (*Decoder) F32

func (d *Decoder) F32() float32

func (*Decoder) F64

func (d *Decoder) F64() float64

func (*Decoder) I32

func (d *Decoder) I32() int32

func (*Decoder) I64

func (d *Decoder) I64() int64

func (*Decoder) String

func (d *Decoder) String() string

func (*Decoder) U8

func (d *Decoder) U8() uint8

func (*Decoder) U16

func (d *Decoder) U16() uint16

func (*Decoder) U32

func (d *Decoder) U32() uint32

func (*Decoder) U64

func (d *Decoder) U64() uint64

type Encoder

type Encoder struct{ Buf []byte }

Encoder writes a little-endian binary stream into Buf. Preallocate with NewEncoder to avoid repeated append growth.

func NewEncoder

func NewEncoder(cap int) *Encoder

func (*Encoder) Bool

func (e *Encoder) Bool(v bool)

func (*Encoder) Bytes

func (e *Encoder) Bytes(v []byte)

func (*Encoder) F32

func (e *Encoder) F32(v float32)

func (*Encoder) F64

func (e *Encoder) F64(v float64)

func (*Encoder) I32

func (e *Encoder) I32(v int32)

func (*Encoder) I64

func (e *Encoder) I64(v int64)

func (*Encoder) String

func (e *Encoder) String(v string)

func (*Encoder) U8

func (e *Encoder) U8(v uint8)

func (*Encoder) U16

func (e *Encoder) U16(v uint16)

func (*Encoder) U32

func (e *Encoder) U32(v uint32)

func (*Encoder) U64

func (e *Encoder) U64(v uint64)

Jump to

Keyboard shortcuts

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