[−][src]Struct bipbuffer::BipBuffer
A Bip-Buffer object
Methods
impl<T: Default> BipBuffer<T>
[src]
pub fn new(length: usize) -> BipBuffer<T>
[src]
Creates and allocates a new buffer of T
elements
pub fn clear(&mut self)
[src]
Clears all regions and reservations
Data in the underlying buffer is unchanged
pub fn reserve(&mut self, length: usize) -> Result<&mut [T], Error>
[src]
Returns a mutable buffer containing up to length
slots for storing data.
If there is less free space than requested, the buffer size will equal the free space.
Returns Error
if there is no free space
pub fn commit(&mut self, length: usize)
[src]
Commits the data in the reservation, allowing it to be read later
If a length
of 0
is passed in, the reservation will be cleared without making any
other changes
pub fn read(&mut self) -> Option<&mut [T]>
[src]
Retrieves available (committed) data as a contiguous block.
Returns None
if there is no data available
pub fn decommit(&mut self, length: usize)
[src]
Marks the first length
elements of the available data is seen.
The next time read()
is called, it will not include these elements.
pub fn committed_len(&self) -> usize
[src]
Number of committed elements
This approximates the size of the buffer that will be returned on read()
pub fn reserved_len(&self) -> usize
[src]
Number of reserved elements
This is the amount of available space for writing data to the buffer
pub fn len(&self) -> usize
[src]
Size of the backing store
Uses len() * size_of(T) + 6 * size_of(usize)
memory overall
pub fn is_empty(&self) -> bool
[src]
Whether any space has been reserved or committed in the buffer
Trait Implementations
Auto Trait Implementations
impl<T> Unpin for BipBuffer<T> where
T: Unpin,
T: Unpin,
impl<T> Sync for BipBuffer<T> where
T: Sync,
T: Sync,
impl<T> Send for BipBuffer<T> where
T: Send,
T: Send,
impl<T> UnwindSafe for BipBuffer<T> where
T: UnwindSafe,
T: UnwindSafe,
impl<T> RefUnwindSafe for BipBuffer<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,