Skip to main content

Module buffer

Module buffer 

Source
Expand description

Alignment-tracking buffer reader/writer for XCDR.

XCDR data is alignment-sensitive: a u32 field must start at a 4-byte boundary, a u64 at an 8-byte boundary, etc. The encoder inserts the necessary padding bytes (value 0) before each write; the decoder skips them.

Alignment is computed relative to the stream start (offset 0), not relative to the current position inside a nested member. This matches OMG XTypes §7.4.1: “All elements are aligned to a multiple of their alignment requirement, relative to the beginning of the encapsulation”.

Deliberate architectural choice: only the dynamic Vec-based writer (alloc feature). A slice-based writer for no_std-without-alloc is not implemented — alloc is a transitive mandatory dependency via zerodds-foundation anyway.

Structs§

BufferReader
Read buffer with alignment tracking.
BufferWriter
Write buffer with alignment tracking and configurable endianness.

Functions§

padding_for
Computes the number of padding bytes to push pos to the next multiple-of-alignment boundary.