Struct iobuf::IORingbuf
[−]
[src]
pub struct IORingbuf { /* fields omitted */ }
A ring buffer implemented with Iobuf
s.
Methods
impl IORingbuf
[src]
fn new(cap: usize) -> Self
Creates a new ring buffer, with room for cap
bytes.
fn push_buf(&mut self) -> &mut RWIobuf<'static>
Returns an Iobuf, whose window may be filled with new data. This acts as the "push" operations for the ringbuf.
It is easy to get garbage data if using a clone of the returned Iobuf. This is not memory-unsafe, but should be avoided.
fn pop_buf(&mut self) -> &mut ROIobuf<'static>
Returns an Iobuf, whose window may be have data consume
d out of it. This
acts as the "pop" operation for the ringbuf.
After emptying out the returned Iobuf, it is not necessarily true that
the ringbuf is empty. To truly empty out the ringbuf, you must pop
Iobufs in a loop until is_empty
returns true
.
It is easy to get garbage data if using a clone of the returned Iobuf. This is not memory-unsafe, but should be avoided.
fn is_empty(&self) -> bool
true
if there is no data to pop in the Iobuf.
fn is_full(&self) -> bool
true
if there is no room for new data in the Iobuf.