pub struct ArrayQueue<I, const N: usize> { /* private fields */ }
Expand description

A frame queue implemented as a ring buffer in a fixed-capacity array

N is the maximum number of frames that the queue can hold. This should be at least as large as the number of frames required for the largest outgoing transfer that will be sent.

Implementations§

source§

impl<I, const N: usize> ArrayQueue<I, N>where I: Default,

source

pub fn new() -> Self

Returns a new emtpy queue

source

pub fn len(&self) -> usize

Returns the number of frames in this queue

source

pub fn is_empty(&self) -> bool

Returns true if this queue does not contain any frames

source

pub fn capacity(&self) -> usize

Returns the maximum number of frames that this queue can hold

Trait Implementations§

source§

impl<I: Debug, const N: usize> Debug for ArrayQueue<I, N>

source§

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

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

impl<I, const N: usize> Default for ArrayQueue<I, N>where I: Default,

source§

fn default() -> Self

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

impl<I, const N: usize> FrameQueue<I> for ArrayQueue<I, N>where I: Clone + Default,

source§

fn try_reserve(&mut self, additional: usize) -> Result<(), OutOfMemoryError>

Attempts to reserve memory for some number of additional frames Read more
source§

fn shrink_to_fit(&mut self)

Attempts to free memory by reducing excess capacity in this queue
source§

fn push_frame(&mut self, frame: Frame<I>) -> Result<(), OutOfMemoryError>

Pushes a frame onto the back of this queue Read more
source§

fn peek_frame(&self) -> Option<&Frame<I>>

Returns a reference to the frame at the front of the queue
source§

fn pop_frame(&mut self) -> Option<Frame<I>>

Removes and returns the frame at the front of the queue
source§

fn return_frame(&mut self, frame: Frame<I>) -> Result<(), OutOfMemoryError>

Returns a not-yet-transmitted frame to the queue Read more

Auto Trait Implementations§

§

impl<I, const N: usize> RefUnwindSafe for ArrayQueue<I, N>where I: RefUnwindSafe,

§

impl<I, const N: usize> Send for ArrayQueue<I, N>where I: Send,

§

impl<I, const N: usize> Sync for ArrayQueue<I, N>where I: Sync,

§

impl<I, const N: usize> Unpin for ArrayQueue<I, N>where I: Unpin,

§

impl<I, const N: usize> UnwindSafe for ArrayQueue<I, N>where I: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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 Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.