[][src]Struct linebuffer::LineBuffer

pub struct LineBuffer<T, B> where
    T: Debug,
    B: ArrayLength<Entry<T>>, 
{ /* fields omitted */ }

Circular Line Buffer

Methods

impl<T, B> LineBuffer<T, B> where
    T: Debug,
    B: ArrayLength<Entry<T>>, 
[src]

pub fn new(max: usize) -> Self[src]

Create new circular buffer of defined data size (bytes)

Note that this is not the amount of entries (lines). LineBuffer will wrap after reaching max bytes or the max amount of lines specified.

Important traits for Iter<'a, T>
pub fn iter(&self) -> Iter<T>[src]

Returns an iterator over the elements

Note that the first iteration step has some overhead to skip invalid entries.

pub fn elements(&self) -> usize[src]

Total amount of inserted elements

pub fn capacity(&self) -> usize[src]

Capacity of elements (lines)

pub fn capacity_bytes(&self) -> usize[src]

Capacity of total bytes

Note that due to fragmentation it is not trivially possible to get the amount of free bytes

pub fn get(&self, idx: usize) -> Option<(&[u8], &T)>[src]

Get element at index, idx counting up since first element inserted.

pub fn insert(&mut self, element: &[u8], addition: T)[src]

Insert element at the front and an additional value, which can be used as flag

Auto Trait Implementations

impl<T, B> Send for LineBuffer<T, B> where
    T: Send

impl<T, B> Sync for LineBuffer<T, B> where
    T: Sync

impl<T, B> Unpin for LineBuffer<T, B> where
    <B as ArrayLength<Entry<T>>>::ArrayType: Unpin

impl<T, B> UnwindSafe for LineBuffer<T, B> where
    <B as ArrayLength<Entry<T>>>::ArrayType: UnwindSafe

impl<T, B> RefUnwindSafe for LineBuffer<T, B> where
    <B as ArrayLength<Entry<T>>>::ArrayType: RefUnwindSafe

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> Borrow<T> for T where
    T: ?Sized
[src]

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

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

impl<T> Same<T> for T

type Output = T

Should always be Self