Struct rbf::RingBuffer [−][src]
pub struct RingBuffer<T, const SIZE: usize> { /* fields omitted */ }
A RingBuffer holds SIZE elements of type T.
Implementations
impl<T: Default + Copy, const SIZE: usize> RingBuffer<T, SIZE>
[src]
pub fn new() -> Self
[src]
Make a new RingBuffer!
pub fn push_overwrite(&mut self, elem: T) -> Option<T>
[src]
Push something onto the buffer. If the buffer is full, the oldest element is returned.
pub fn push_unless_full(&mut self, elem: T) -> Result<(), Error>
[src]
Push something onto the buffer, unless the buffer is full.
pub fn pop(&mut self) -> Option<T>
[src]
Pop the buffer. If it is empty, then None is returned.
pub fn len(&self) -> usize
[src]
How many elements are in the buffer?
pub fn is_empty(&self) -> bool
[src]
Is the buffer empty?
pub fn is_full(&self) -> bool
[src]
Is the buffer full?
impl<T: Default + Copy, const SIZE: usize> RingBuffer<T, SIZE>
[src]
pub fn iter(&self) -> IntoIteratorRingbuffer<'_, T, SIZE>ⓘNotable traits for IntoIteratorRingbuffer<'a, T, SIZE>
impl<'a, T: Default + Copy, const SIZE: usize> Iterator for IntoIteratorRingbuffer<'a, T, SIZE> type Item = &'a T;
[src]
Notable traits for IntoIteratorRingbuffer<'a, T, SIZE>
impl<'a, T: Default + Copy, const SIZE: usize> Iterator for IntoIteratorRingbuffer<'a, T, SIZE> type Item = &'a T;
Make an immutable non-consuming iterator
Trait Implementations
impl<T: Default + Copy, const SIZE: usize> Default for RingBuffer<T, SIZE>
[src]
impl<T: Default + Copy, const SIZE: usize> IntoIterator for RingBuffer<T, SIZE>
[src]
type Item = T
The type of the elements being iterated over.
type IntoIter = ConsumingIntoIteratorRingbuffer<T, SIZE>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
impl<'a, T: Default + Copy, const SIZE: usize> IntoIterator for &'a RingBuffer<T, SIZE>
[src]
Auto Trait Implementations
impl<T, const SIZE: usize> Send for RingBuffer<T, SIZE> where
T: Send,
T: Send,
impl<T, const SIZE: usize> Sync for RingBuffer<T, SIZE> where
T: Sync,
T: Sync,
impl<T, const SIZE: usize> Unpin for RingBuffer<T, SIZE> where
T: Unpin,
T: Unpin,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
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.
pub 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>,