Module codec
Expand description
Framing helpers for turning a byte stream into Packets and back.
PacketReaderbuffers arbitrary chunks behind aByteBufferand 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.PacketWriteris the outbound mirror: it encodes packets in place into aByteBufferfor 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ยง
Structsยง
- Array
Buffer - A fixed-capacity
ByteBufferbacked by an inline[u8; N]. - Capacity
Exceeded - Error returned by
ByteBuffer::spare/extendwhen a fixed-capacity buffer is full. - Grow
Buffer alloc - A heap-backed
ByteBufferthat grows as needed. - Packet
Reader - A buffering, sans-io packet framer.
- Packet
Writer - A buffering, sans-io packet serializer.
Enumsยง
- Write
Error - Error returned by
PacketWriter::write.
Traitsยง
- Byte
Buffer - Contiguous byte storage shared by
PacketReaderandPacketWriter.