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>

source

pub fn new() -> Self

Creates a new queue.

source

pub fn is_empty(&self) -> bool

Returns true if the queue is empty, otherwise false

source

pub fn capacity(&self) -> usize

Returns the capacity of the queue

source

pub fn len(&self) -> usize

Returns the number of elements inside the queue

source

pub fn is_full(&self) -> bool

Returns true if the queue is full, otherwise false

source

pub fn clear(&mut self)

Removes all elements from the queue

source

pub fn pop(&mut self) -> Option<T>

Acquire an element from the queue. If the queue is empty it returns None.

source

pub fn push(&mut self, value: T) -> bool

Adds an element to the queue. If the queue is full it returns false, otherwise true.

source

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>

source

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
source

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: Debug, const CAPACITY: usize> Debug for FixedSizeQueue<T, CAPACITY>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<T, const CAPACITY: usize> Default for FixedSizeQueue<T, CAPACITY>

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<T: Send, const CAPACITY: usize> Send for FixedSizeQueue<T, CAPACITY>

source§

impl<T: Sync, const CAPACITY: usize> Sync for FixedSizeQueue<T, CAPACITY>

Auto Trait Implementations§

§

impl<T, const CAPACITY: usize> !Freeze for FixedSizeQueue<T, CAPACITY>

§

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.