Struct iceoryx2_bb_container::queue::FixedSizeQueue
source · #[repr(C)]pub struct FixedSizeQueue<T, const CAPACITY: usize> { /* private fields */ }Expand description
Relocatable queue with compile time fixed size capacity. In contrast to its counterpart the
Queue it is movable.
Implementations§
source§impl<T, const CAPACITY: usize> FixedSizeQueue<T, CAPACITY>
impl<T, const CAPACITY: usize> FixedSizeQueue<T, CAPACITY>
sourcepub fn pop(&mut self) -> Option<T>
pub fn pop(&mut self) -> Option<T>
Acquire an element from the queue. If the queue is empty it returns None.
sourcepub fn push(&mut self, value: T) -> bool
pub fn push(&mut self, value: T) -> bool
Adds an element to the queue. If the queue is full it returns false, otherwise true.
sourcepub fn push_with_overflow(&mut self, value: T) -> Option<T>
pub fn push_with_overflow(&mut self, value: T) -> Option<T>
Adds an element to the queue. If the queue is full it returns the oldest element,
otherwise None.
source§impl<T: Copy + Debug, const CAPACITY: usize> FixedSizeQueue<T, CAPACITY>
impl<T: Copy + Debug, const CAPACITY: usize> FixedSizeQueue<T, CAPACITY>
sourcepub unsafe fn get_unchecked(&self, index: usize) -> T
pub unsafe fn get_unchecked(&self, index: usize) -> T
Returns a copy of the element stored at index. The index is starting by 0 for the first
element until FixedSizeQueue::len().
Safety
- The index must be not out of bounds
sourcepub fn get(&self, index: usize) -> T
pub fn get(&self, index: usize) -> T
Returns a copy of the element stored at index. The index is starting by 0 for the first
element until FixedSizeQueue::len().
Trait Implementations§
source§impl<T, const CAPACITY: usize> Default for FixedSizeQueue<T, CAPACITY>
impl<T, const CAPACITY: usize> Default for FixedSizeQueue<T, CAPACITY>
impl<T: Send, const CAPACITY: usize> Send for FixedSizeQueue<T, CAPACITY>
impl<T: Sync, const CAPACITY: usize> Sync for FixedSizeQueue<T, CAPACITY>
Auto Trait Implementations§
impl<T, const CAPACITY: usize> RefUnwindSafe for FixedSizeQueue<T, CAPACITY>where
T: RefUnwindSafe,
impl<T, const CAPACITY: usize> Unpin for FixedSizeQueue<T, CAPACITY>where
T: Unpin,
impl<T, const CAPACITY: usize> UnwindSafe for FixedSizeQueue<T, CAPACITY>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