Documentation
¶
Index ¶
- Constants
- Variables
- func NewDefault() codec.Codec
- func NewManager(maxSize int) codec.Manager
- type LinearCodec
- type Manager
- func (m *Manager) Marshal(version uint16, source interface{}) ([]byte, error)
- func (m *Manager) RegisterCodec(version uint16, codec codec.Codec) error
- func (m *Manager) Size(version uint16, source interface{}) (int, error)
- func (m *Manager) Unmarshal(source []byte, destination interface{}) (uint16, error)
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 ¶
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) RegisterCodec ¶
RegisterCodec registers a codec for a version
Click to show internal directories.
Click to hide internal directories.