Queue

Struct Queue 

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

A first-in, first-out data structure backed by a Deque

Implementations§

Source§

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

Source

pub fn into_inner(self) -> Deque<'a, T, A>

Turns the Queue into its inner Deque

Source

pub fn is_empty(&self) -> bool

Returns true if the queue contains no elements

Source

pub fn iter(&self) -> Iter<'a, T>

Produces an iterator over all of the elements in the queue

Source

pub fn iter_mut(&mut self) -> IterMut<'a, T>

Produces a mutable iterator over all of the elements in the queue

Source

pub fn len(&self) -> usize

Returns the number of elements in the queue

Source

pub unsafe fn new_in(allocator: A) -> Self

Creates a new queue inside an allocator

§Arguments

allocator: The allocator

§Safety

The allocator specified must safely allocate ande de-allocate valid memory

Source

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

Pops an element from the queue, returning the element on top if there was one

Source

pub fn push(&mut self, elem: T)

Pushes an element to the queue

Source

pub fn top(&self) -> Option<&T>

Peeks the top element in the queue without popping it

Trait Implementations§

Source§

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

Source§

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

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

impl<'a, T: 'a, A: Allocator + Default> Default for Queue<'a, T, A>

Source§

fn default() -> Self

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

impl<'a, T: 'a, A: Allocator + Default> FromIterator<T> for Queue<'a, T, A>

Source§

fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl<'a, T: 'a, A: Allocator> IntoIterator for Queue<'a, T, A>

Source§

type Item = T

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter<'a, T, A>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

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

Source§

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

Auto Trait Implementations§

§

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

§

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

§

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

§

impl<'a, T, A> UnwindSafe for Queue<'a, 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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.