Skip to main content

Module buf

Module buf 

Source
Expand description

Zero-copy cursor primitives over borrowed byte slices.

ReadBuf wraps an immutable &[u8] and tracks a read position. It hands back sub-slices that borrow from the original buffer, so decoders never copy. WriteBuf wraps a mutable &mut [u8] and tracks a write position into a caller-owned region.

Both cursors are no_std-compatible and allocation-free.

Structsยง

ReadBuf
Cursor over an immutable byte slice with a tracked read position.
WriteBuf
Cursor over a mutable byte slice with a tracked write position.