Bip-Buffer
A Rust implementation of Simon Cooke's Bip-Buffer
A Bip-Buffer is similar to a circular buffer, but data is inserted in two revolving regions of the buffer space. This allows reads to return contiguous blocks of memory, even if they span a region that would normally include a wrap-around in a circular buffer. It's especially useful for APIs requiring blocks of contiguous memory, eliminating the need to copy data into an interim buffer before use.
Examples
use BipBuffer;
// Creates a 4-element Bip-Buffer of u8
let mut buffer: = new;
// Stores the values into an available region,
// clearing the existing reservation
buffer.commit;
// Marks the first two parts of the block as free
buffer.decommit;