pub struct FixedQueue<T, const N: usize> {
entries: [MaybeUninit<T>; N],
head: usize,
len: usize,
}Expand description
Fixed-capacity FIFO queue with no heap allocation.
Fields§
§entries: [MaybeUninit<T>; N]§head: usize§len: usizeImplementations§
Source§impl<T, const N: usize> FixedQueue<T, N>
impl<T, const N: usize> FixedQueue<T, N>
Sourcepub fn get(&self, index: usize) -> Option<&T>
pub fn get(&self, index: usize) -> Option<&T>
Returns a shared reference to the element at index from the front.
Sourcepub fn iter(&self) -> FixedQueueIter<'_, T, N> ⓘ
pub fn iter(&self) -> FixedQueueIter<'_, T, N> ⓘ
Returns an iterator from front to back.
Sourcepub fn push_back(&mut self, value: T) -> Result<(), T>
pub fn push_back(&mut self, value: T) -> Result<(), T>
Appends an element to the tail of the queue.
Sourcepub fn pop_front(&mut self) -> Option<T>
pub fn pop_front(&mut self) -> Option<T>
Removes and returns the element at the head of the queue.
Sourcepub fn remove_first_where<F>(&mut self, predicate: F) -> Option<T>
pub fn remove_first_where<F>(&mut self, predicate: F) -> Option<T>
Removes the first element matching predicate.
fn remove_at(&mut self, offset: usize) -> T
Trait Implementations§
Source§impl<T, const N: usize> Drop for FixedQueue<T, N>
impl<T, const N: usize> Drop for FixedQueue<T, N>
Auto Trait Implementations§
impl<T, const N: usize> Freeze for FixedQueue<T, N>where
T: Freeze,
impl<T, const N: usize> RefUnwindSafe for FixedQueue<T, N>where
T: RefUnwindSafe,
impl<T, const N: usize> Send for FixedQueue<T, N>where
T: Send,
impl<T, const N: usize> Sync for FixedQueue<T, N>where
T: Sync,
impl<T, const N: usize> Unpin for FixedQueue<T, N>where
T: Unpin,
impl<T, const N: usize> UnsafeUnpin for FixedQueue<T, N>where
T: UnsafeUnpin,
impl<T, const N: usize> UnwindSafe for FixedQueue<T, N>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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more