Crate structbuf

source ·
Expand description

Capacity-limited structured data buffer.

This library provides StructBuf - a capacity-limited structured data buffer for encoding and decoding message packets.

Structs

Packer of POD values into a StructBuf. The packer maintains an index where new values are written, which may be less than the current buffer length. Little-endian encoding is assumed. All write operations panic if the buffer capacity limit is exceeded.
A capacity-limited buffer for encoding and decoding structured data. The buffer starts out with a small internal capacity that does not require allocation. It performs at most one heap allocation up to the capacity limit once the internal capacity is exceeded. The relationship len <= cap <= lim always holds. It panics if a write operation exceeds the limit.
Unpacker of POD values from a byte slice. Any reads past the end of the slice return default values rather than panicking. The caller must check the error status at the end to determine whether all returned values were valid. Little-endian encoding is assumed.