Struct StaticRingQueue

Source
pub struct StaticRingQueue<T, const N: usize> { /* private fields */ }
Expand description

A statically-sized queue which is implemented as a ring buffer.

Implementations§

Source§

impl<T, const N: usize> StaticRingQueue<T, N>

Source

pub fn new() -> Self

Creates a new queue.

Trait Implementations§

Source§

impl<T, const N: usize> Default for StaticRingQueue<T, N>

Source§

fn default() -> Self

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

impl<T, const N: usize> QueueModel for StaticRingQueue<T, N>

Source§

type Item = T

The type of items in the queue.
Source§

fn enqueue(&mut self, item: Self::Item) -> bool

Attempts to enqueue an item; returns whether or not it was successful.
Source§

fn dequeue(&mut self) -> Option<Self::Item>

Attempts to dequeue an item; returns None if there are no items available.
Source§

fn count(&self) -> usize

Checks the current number of items in the queue.
Source§

fn is_empty(&self) -> bool

Checks if the queue is empty.

Auto Trait Implementations§

§

impl<T, const N: usize> Freeze for StaticRingQueue<T, N>
where T: Freeze,

§

impl<T, const N: usize> RefUnwindSafe for StaticRingQueue<T, N>
where T: RefUnwindSafe,

§

impl<T, const N: usize> Send for StaticRingQueue<T, N>
where T: Send,

§

impl<T, const N: usize> Sync for StaticRingQueue<T, N>
where T: Sync,

§

impl<T, const N: usize> Unpin for StaticRingQueue<T, N>
where T: Unpin,

§

impl<T, const N: usize> UnwindSafe for StaticRingQueue<T, N>
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>,

Source§

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>,

Source§

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.