linear

package
v1.2.16 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2025 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const MaxInt = math.MaxInt32

Variables

View Source
var (
	ErrUnknownVersion      = errors.New("unknown codec version")
	ErrMarshalNil          = errors.New("can't marshal nil")
	ErrUnmarshalNil        = errors.New("can't unmarshal nil")
	ErrUnexpectedType      = errors.New("unexpected type")
	ErrDoesNotImplement    = errors.New("type does not implement interface")
	ErrUnexportedField     = errors.New("unexported field")
	ErrMaxSliceLenExceeded = errors.New("max slice length exceeded")
)

Functions

func NewDefault

func NewDefault() codec.Codec

NewDefault creates a new linear codec

func NewManager

func NewManager(maxSize int) codec.Manager

NewManager creates a new codec manager

Types

type LinearCodec

type LinearCodec struct{}

LinearCodec is a simple codec implementation

func (*LinearCodec) MarshalInto

func (c *LinearCodec) MarshalInto(source interface{}, destination []byte) error

MarshalInto marshals the source into the destination buffer

func (*LinearCodec) Size

func (c *LinearCodec) Size(value interface{}) (int, error)

Size returns the encoded size of the value

func (*LinearCodec) Unmarshal

func (c *LinearCodec) Unmarshal(source []byte, destination interface{}) error

Unmarshal unmarshals from source into destination

type Manager

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

Manager implements codec.Manager

func (*Manager) Marshal

func (m *Manager) Marshal(version uint16, source interface{}) ([]byte, error)

Marshal encodes the source object

func (*Manager) RegisterCodec

func (m *Manager) RegisterCodec(version uint16, codec codec.Codec) error

RegisterCodec registers a codec for a version

func (*Manager) Size

func (m *Manager) Size(version uint16, source interface{}) (int, error)

Size returns the encoded size of the object

func (*Manager) Unmarshal

func (m *Manager) Unmarshal(source []byte, destination interface{}) (uint16, error)

Unmarshal decodes into the destination object

Jump to

Keyboard shortcuts

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