Module codec

Module codec 

Expand description

Framing helpers for turning a byte stream into Packets and back.

  • PacketReader buffers arbitrary chunks behind a ByteBuffer and yields whole packets. Because all parse state lives in the reader rather than in a future, an I/O driver can read in a single cancellation-safe step and never lose partially-read bytes.
  • PacketWriter is the outbound mirror: it encodes packets in place into a ByteBuffer for an I/O driver to drain, with no per-packet allocation.

PacketReader and PacketWriter pair with ArrayBuffer for no-alloc operation or GrowBuffer when alloc is available.

Modulesยง

buffer ๐Ÿ”’
reader ๐Ÿ”’
writer ๐Ÿ”’

Structsยง

ArrayBuffer
A fixed-capacity ByteBuffer backed by an inline [u8; N].
CapacityExceeded
Error returned by ByteBuffer::spare/extend when a fixed-capacity buffer is full.
GrowBufferalloc
A heap-backed ByteBuffer that grows as needed.
PacketReader
A buffering, sans-io packet framer.
PacketWriter
A buffering, sans-io packet serializer.

Enumsยง

WriteError
Error returned by PacketWriter::write.

Traitsยง

ByteBuffer
Contiguous byte storage shared by PacketReader and PacketWriter.