edf

package
v1.999.225-0...-1e15b2a Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBinaryTooLong = fmt.Errorf("binary too long - max allowed length is 2^32-1 bytes (4GB)")
	ErrStringTooLong = fmt.Errorf("string too long - max allowed length is 2^16-1 (65535) bytes")
	ErrAtomTooLong   = fmt.Errorf("atom too long - max allowed length is 255 bytes")
	ErrErrorTooLong  = fmt.Errorf("error too long - max allowed length is 32767 bytes")
)

Functions

func Decode

func Decode(packet []byte, options Options) (_ any, _ []byte, ret error)

Decode

func Encode

func Encode(x any, b *lib.Buffer, options Options) (ret error)

Encode

func GetAtomCache

func GetAtomCache() map[uint16]gen.Atom

func GetErrCache

func GetErrCache() map[uint16]error

func GetRegCache

func GetRegCache() map[uint16]string

func MakeEncodeRegTypeCache

func MakeEncodeRegTypeCache(names []string) *sync.Map

func RegisterAtom

func RegisterAtom(a gen.Atom) error

func RegisterError

func RegisterError(e error) error

func RegisterTypeOf

func RegisterTypeOf(v any) error

Types

type Marshaler

type Marshaler interface {
	MarshalEDF(io.Writer) error
}

type Options

type Options struct {
	AtomCache   *sync.Map // atom => id (encoding), id => atom (decoding)
	AtomMapping *sync.Map // atomX => atomY (encoding/decoding)
	RegCache    *sync.Map // type/name => id (encoding), id => type (for decoding)
	ErrCache    *sync.Map // error => id (for encoder), id => error (for decoder)
	Cache       *sync.Map // common cache (caching reflect.Type => encoder, string([]byte) => decoder)
}

Options for encoding/decoding

type Unmarshaler

type Unmarshaler interface {
	UnmarshalEDF([]byte) error
}

Jump to

Keyboard shortcuts

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