[−][src]Struct linebuffer::LineBuffer
Circular Line Buffer
Methods
impl<T, B> LineBuffer<T, B> where
T: Debug,
B: ArrayLength<Entry<T>>,
[src]
T: Debug,
B: ArrayLength<Entry<T>>,
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,
T: Send,
impl<T, B> Sync for LineBuffer<T, B> where
T: Sync,
T: Sync,
impl<T, B> Unpin for LineBuffer<T, B> where
<B as ArrayLength<Entry<T>>>::ArrayType: Unpin,
<B as ArrayLength<Entry<T>>>::ArrayType: Unpin,
impl<T, B> UnwindSafe for LineBuffer<T, B> where
<B as ArrayLength<Entry<T>>>::ArrayType: UnwindSafe,
<B as ArrayLength<Entry<T>>>::ArrayType: UnwindSafe,
impl<T, B> RefUnwindSafe for LineBuffer<T, B> where
<B as ArrayLength<Entry<T>>>::ArrayType: RefUnwindSafe,
<B as ArrayLength<Entry<T>>>::ArrayType: RefUnwindSafe,
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
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> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Same<T> for T
type Output = T
Should always be Self