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>
impl<T> StableQueue<T>
pub fn new_unbounded() -> Self
Sourcepub fn with_fixed_capacity(cap: usize) -> Self
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.
pub fn front(&self) -> Option<&T>
pub fn front_mut(&mut self) -> Option<&mut T>
pub fn back(&self) -> Option<&T>
pub fn back_mut(&mut self) -> Option<&mut T>
pub fn push_back(&mut self, value: T) -> Result<StableIndex, T>
pub fn pop_front(&mut self) -> Option<T>
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn get(&self, StableIndex: StableIndex) -> Option<&T>
pub fn get_mut(&mut self, StableIndex: StableIndex) -> Option<&mut T>
pub fn front_idx(&self) -> Option<StableIndex>
pub fn back_idx(&self) -> Option<StableIndex>
pub fn fixed_capacity(&self) -> Option<usize>
Trait Implementations§
Source§impl<T> Index<StableIndex> for StableQueue<T>
impl<T> Index<StableIndex> for StableQueue<T>
Source§impl<T> IndexMut<StableIndex> for StableQueue<T>
impl<T> IndexMut<StableIndex> for StableQueue<T>
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more