marshal

package module
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2024 License: MIT Imports: 2 Imported by: 52

README

Go encoding library

CI

Written in Goose for verification in Iris.

To translate with goose:

goose -out ~/code/perennial/external/Goose

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadBool added in v0.5.0

func ReadBool(b []byte) (bool, []byte)

func ReadBytes added in v0.4.3

func ReadBytes(b []byte, l uint64) ([]byte, []byte)

ReadBytes reads `l` bytes from b and returns (bs, rest)

func ReadBytesCopy added in v0.4.3

func ReadBytesCopy(b []byte, l uint64) ([]byte, []byte)

Like ReadBytes, but avoids keeping the source slice [b] alive.

func ReadInt added in v0.4.0

func ReadInt(b []byte) (uint64, []byte)

func ReadInt32 added in v0.6.0

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

func ReadLenPrefixedBytes added in v0.5.0

func ReadLenPrefixedBytes(b []byte) ([]byte, []byte)

func WriteBool added in v0.5.0

func WriteBool(b []byte, x bool) []byte

func WriteBytes added in v0.4.2

func WriteBytes(b []byte, data []byte) []byte

Append data to b, returning the new slice.

func WriteInt added in v0.4.0

func WriteInt(b []byte, i uint64) []byte

WriteInt appends i in little-endian format to b, returning the new slice.

func WriteInt32 added in v0.6.0

func WriteInt32(b []byte, i uint32) []byte

WriteInt32 appends 32-bit integer i in little-endian format to b, returning the new slice.

func WriteLenPrefixedBytes added in v0.5.0

func WriteLenPrefixedBytes(b []byte, bs []byte) []byte

Types

type Dec

type Dec struct {
	// contains filtered or unexported fields
}

Dec is a stateful decoder that returns values encoded sequentially in a single slice.

func NewDec

func NewDec(b []byte) Dec

func (Dec) GetBool

func (dec Dec) GetBool() bool

func (Dec) GetBytes

func (dec Dec) GetBytes(num uint64) []byte

func (Dec) GetInt

func (dec Dec) GetInt() uint64

func (Dec) GetInt32

func (dec Dec) GetInt32() uint32

func (Dec) GetInts

func (dec Dec) GetInts(num uint64) []uint64

type Enc

type Enc struct {
	// contains filtered or unexported fields
}

Enc is a stateful encoder for a statically-allocated array.

func NewEnc

func NewEnc(sz uint64) Enc

func NewEncFromSlice added in v0.2.0

func NewEncFromSlice(b []byte) Enc

func (Enc) Finish

func (enc Enc) Finish() []byte

func (Enc) PutBool

func (enc Enc) PutBool(b bool)

func (Enc) PutBytes

func (enc Enc) PutBytes(b []byte)

func (Enc) PutInt

func (enc Enc) PutInt(x uint64)

func (Enc) PutInt32

func (enc Enc) PutInt32(x uint32)

func (Enc) PutInts

func (enc Enc) PutInts(xs []uint64)

Jump to

Keyboard shortcuts

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