Struct Queue

Source
pub struct Queue<T, A>
where A: Allocator,
{ /* private fields */ }
Expand description

A doubly-linked list that owns elements of type T backed by the specified allocator A.

Implementations§

Source§

impl<T, A: Allocator> Queue<T, A>

Source

pub fn try_new_in(alloc: A) -> Result<Self, AllocError>

Creates a new list with specified allocator.

Source

pub fn allocator(&self) -> &A

Returns a reference to the underlying allocator.

Source

pub fn is_empty(&self) -> bool

Returns true if the list contains no elements.

Source

pub fn len(&self) -> usize

Returns the number of elements in the queue.

Source

pub fn iter(&self) -> QueueIter<'_, T>

Returns an iterator over the entries of the list.

Source

pub fn iter_mut(&mut self) -> QueueIterMut<'_, T>

Returns a mutable iterator over the entries of the list.

Source

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

Removes the last element and returns it or None if the list is empty.

Source

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

Removes the first element and returns it or None if the list is empty.

Source

pub fn push_back(&mut self, item: T) -> Result<&mut T, AllocError>

Appends an element to the end of the list.

Source

pub fn push_front(&mut self, item: T) -> Result<&mut T, AllocError>

Appends an element to the beginning of the list.

Trait Implementations§

Source§

impl<T: Debug, A> Debug for Queue<T, A>
where A: Allocator + Debug,

Source§

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

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

impl<T, A> Drop for Queue<T, A>
where A: Allocator,

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<T, A> Send for Queue<T, A>
where A: Send + Allocator, T: Send,

Source§

impl<T, A> Sync for Queue<T, A>
where A: Sync + Allocator, T: Sync,

Auto Trait Implementations§

§

impl<T, A> Freeze for Queue<T, A>
where A: Freeze,

§

impl<T, A> RefUnwindSafe for Queue<T, A>

§

impl<T, A> Unpin for Queue<T, A>
where A: Unpin,

§

impl<T, A> UnwindSafe for Queue<T, A>

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.