Documentation
¶
Index ¶
- Variables
- func Write(out io.Writer, cb func(w *Writer) error) error
- type Allocator
- type HeapAllocator
- type LinearAllocator
- type Option
- func Begin(f func() error) Option
- func Bool(num int, f func(bool) error) Option
- func Bytes(num int, f func([]byte) error) Option
- func Double(num int, f func(float64) error) Option
- func End(f func() error) Option
- func Enum(num int, f func(int32) error) Option
- func Fixed32(num int, f func(uint32) error) Option
- func Fixed64(num int, f func(uint64) error) Option
- func Float(num int, f func(float32) error) Option
- func Int32(num int, f func(int32) error) Option
- func Int64(num int, f func(int64) error) Option
- func Message(num int, n *RawPB) Option
- func Name(name string) Option
- func Sfixed32(num int, f func(int32) error) Option
- func Sfixed64(num int, f func(int64) error) Option
- func Sint32(num int, f func(int32) error) Option
- func Sint64(num int, f func(int64) error) Option
- func String(num int, f func(string) error) Option
- func Uint32(num int, f func(uint32) error) Option
- func Uint64(num int, f func(uint64) error) Option
- func UnknownBytes(f func(num int, v []byte) error) Option
- func UnknownFixed32(f func(num int, v uint32) error) Option
- func UnknownFixed64(f func(num int, v uint64) error) Option
- func UnknownVarint(f func(num int, v uint64) error) Option
- func Varint(num int, f func(uint64) error) Option
- type RawPB
- type Reader
- type Writer
- func (w *Writer) Bool(num int, v bool)
- func (w *Writer) Bytes(num int, v []byte)
- func (w *Writer) Double(num int, v float64)
- func (w *Writer) Enum(num int, v int32)
- func (w *Writer) Err() error
- func (w *Writer) Fixed32(num int, v uint32)
- func (w *Writer) Fixed64(num int, v uint64)
- func (w *Writer) Float(num int, v float32)
- func (w *Writer) Int32(num int, v int32)
- func (w *Writer) Int64(num int, v int64)
- func (w *Writer) Message(num int, cb func(w *Writer) error)
- func (w *Writer) Sfixed32(num int, v int32)
- func (w *Writer) Sfixed64(num int, v int64)
- func (w *Writer) Sint32(num int, v int32)
- func (w *Writer) Sint64(num int, v int64)
- func (w *Writer) String(num int, v string)
- func (w *Writer) Uint32(num int, v uint32)
- func (w *Writer) Uint64(num int, v uint64)
Constants ¶
This section is empty.
Variables ¶
var ErrorInvalidMessage = errors.New("invalid message")
var ErrorTruncated = errors.New("message truncated")
var ErrorWrongWireType = errors.New("wrong wire type")
Functions ¶
Types ¶
type HeapAllocator ¶
type HeapAllocator struct {
}
HeapAllocator uses Go's built-in memory allocation
func (*HeapAllocator) Alloc ¶
func (a *HeapAllocator) Alloc(n int) []byte
type LinearAllocator ¶
type LinearAllocator struct {
// contains filtered or unexported fields
}
LinearAllocator uses a single growing buffer for allocations
func NewLinearAllocator ¶
func NewLinearAllocator() *LinearAllocator
NewLinearAllocator creates a linear allocator with initial capacity
func (*LinearAllocator) Alloc ¶
func (a *LinearAllocator) Alloc(n int) []byte
func (*LinearAllocator) Grow ¶
func (a *LinearAllocator) Grow(size int)
Grow pre-allocates buffer space for expected allocations
func (*LinearAllocator) Reset ¶
func (a *LinearAllocator) Reset()
Reset recycles the allocation buffer for reuse
type Option ¶
type Option func(*RawPB)
Option configures RawPB parser behavior
func Double ¶
Double registers a callback for double-precision floating point numbers using fixed64 encoding
func Float ¶
Float registers a callback for single-precision floating point numbers using fixed32 encoding
func String ¶
String registers a callback for string values from length-delimited fields. Uses unsafe conversion from byte slice to avoid allocation.
func UnknownBytes ¶
UnknownBytes handles unregistered length-delimited fields
func UnknownFixed32 ¶
UnknownFixed32 handles unregistered fixed32 fields
func UnknownFixed64 ¶
UnknownFixed64 handles unregistered fixed64 fields
func UnknownVarint ¶
UnknownVarint handles unregistered varint fields
type RawPB ¶
type RawPB struct {
// contains filtered or unexported fields
}
RawPB implements a low-level protocol buffer parser without code generation
type Reader ¶
type Reader interface {
io.Reader
io.ByteScanner
}
Reader combines io.Reader with io.ByteScanner for reading protocol buffer data
type Writer ¶ added in v1.1.0
type Writer struct {
// contains filtered or unexported fields
}
Writer implements a low-level protocol buffer writer without code generation
func (*Writer) Message ¶ added in v1.1.0
Message writes a protocol buffer submessage using a callback function
func (*Writer) Sint32 ¶ added in v1.1.0
Sint32 writes a signed 32-bit integer field using zigzag encoding
func (*Writer) Sint64 ¶ added in v1.1.0
Sint64 writes a signed 64-bit integer field using zigzag encoding