Struct StableQueue

Source
pub struct StableQueue<T> { /* private fields */ }
Expand description

As long as the element is not popped, the index returned by push_back will continue to point to the pushed element.

Implementations§

Source§

impl<T> StableQueue<T>

Source

pub fn new_unbounded() -> Self

Source

pub fn with_fixed_capacity(cap: usize) -> Self

If initialized with a fixed capacity, the queue cannot grow beyond that capacity and the address in memory of elements inserted into the queue will not change.

Source

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

Source

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

Source

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

Source

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

Source

pub fn push_back(&mut self, value: T) -> Result<StableIndex, T>

Source

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

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn get(&self, StableIndex: StableIndex) -> Option<&T>

Source

pub fn get_mut(&mut self, StableIndex: StableIndex) -> Option<&mut T>

Source

pub fn front_idx(&self) -> Option<StableIndex>

Source

pub fn back_idx(&self) -> Option<StableIndex>

Source

pub fn fixed_capacity(&self) -> Option<usize>

Trait Implementations§

Source§

impl<T> Index<StableIndex> for StableQueue<T>

Source§

type Output = T

The returned type after indexing.
Source§

fn index(&self, idx: StableIndex) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<T> IndexMut<StableIndex> for StableQueue<T>

Source§

fn index_mut(&mut self, idx: StableIndex) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more

Auto Trait Implementations§

§

impl<T> Freeze for StableQueue<T>

§

impl<T> RefUnwindSafe for StableQueue<T>
where T: RefUnwindSafe,

§

impl<T> Send for StableQueue<T>
where T: Send,

§

impl<T> Sync for StableQueue<T>
where T: Sync,

§

impl<T> Unpin for StableQueue<T>
where T: Unpin,

§

impl<T> UnwindSafe for StableQueue<T>
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.