pub struct RingPool<T, const CAP: usize>{ /* private fields */ }
Implementations§
source§impl<T, const CAP: usize> RingPool<T, CAP>
impl<T, const CAP: usize> RingPool<T, CAP>
pub fn new() -> Self
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn clear(&mut self)
pub fn spawn(&mut self) -> Option<&T>
sourcepub fn push(&mut self, elem: T) -> Option<T>
pub fn push(&mut self, elem: T) -> Option<T>
Pushes a new item to the head of the buffer, returning the old one that was “pushed out” if this is a ring-buffer.
sourcepub fn pop(&mut self) -> Option<T>
pub fn pop(&mut self) -> Option<T>
“Pops” the tail end of the buffer, reducing the length and returning the popped item.
pub fn get(&self, i: usize) -> Option<&T>
pub fn get_mut(&mut self, i: usize) -> Option<&mut T>
pub fn capacity(&self) -> usize
pub fn iter(&self) -> Iter<'_, T>
pub fn iter_mut(&mut self) -> IterMut<'_, T>
Trait Implementations§
Auto Trait Implementations§
impl<T, const CAP: usize> Freeze for RingPool<T, CAP>where
T: Freeze,
impl<T, const CAP: usize> RefUnwindSafe for RingPool<T, CAP>where
T: RefUnwindSafe,
impl<T, const CAP: usize> Send for RingPool<T, CAP>where
T: Send,
impl<T, const CAP: usize> Sync for RingPool<T, CAP>where
T: Sync,
impl<T, const CAP: usize> Unpin for RingPool<T, CAP>where
T: Unpin,
impl<T, const CAP: usize> UnwindSafe for RingPool<T, CAP>where
T: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more