[][src]Struct bipbuffer::BipBuffer

pub struct BipBuffer<T> { /* fields omitted */ }

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

impl<T: Debug> Debug for BipBuffer<T>[src]

Auto Trait Implementations

impl<T> Send for BipBuffer<T> where
    T: Send

impl<T> Unpin for BipBuffer<T> where
    T: Unpin

impl<T> Sync for BipBuffer<T> where
    T: Sync

impl<T> RefUnwindSafe for BipBuffer<T> where
    T: RefUnwindSafe

impl<T> UnwindSafe for BipBuffer<T> where
    T: UnwindSafe

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]