Skip to main content

Module growable

Module growable 

Source
Expand description

Growable ring buffer (Buffer).

Same position / end / capacity discipline as fixed.rs but grows the backing Vec<u8> on demand up to a configured cap. Shift / insert / replace operations use overlapping-safe std::ptr::copy (NOT copy_nonoverlapping) with bounds checked against self.capacity().

The buffer carries command-channel frames, some of which hold protected values, so it keeps one invariant: every byte of memory outside the pending window position..end is zero. Consuming, reading, resetting, shifting, deleting or replacing erases the bytes that stop being pending, and growing or shrinking copies the pending window into a fresh zeroed allocation and erases the old one before releasing it, instead of letting Vec::resize / Vec::shrink_to_fit free it unwiped. Drop erases what is still pending, and Debug prints offsets only.

Structsยง

Buffer