pub struct IndexStack { /* private fields */ }Expand description
Bounded LIFO stack of u32 values below its capacity.
Implementations§
Source§impl IndexStack
impl IndexStack
Sourcepub const MAX_CAPACITY: u32
pub const MAX_CAPACITY: u32
The largest capacity (2^24 - 1 values).
Sourcepub fn with_capacity(capacity: u32) -> Self
pub fn with_capacity(capacity: u32) -> Self
An empty stack for the values 0..capacity; a capacity above
Self::MAX_CAPACITY is reduced to it.
Sourcepub fn capacity(&self) -> usize
pub fn capacity(&self) -> usize
The number of values the stack can hold (every value is below it).
Sourcepub fn push(&self, value: u32) -> Result<(), u32>
pub fn push(&self, value: u32) -> Result<(), u32>
Pushes value; returns it back if it is not below the capacity.
Never blocks. value must not already be on the stack: pushing it
twice corrupts the stack (a cycle that pops repeat, and the entries
below it lost). The pool pushes an index once, when its buffer is
dropped.
Auto Trait Implementations§
impl !Freeze for IndexStack
impl Forget for IndexStack
impl Move for IndexStack
impl RefUnwindSafe for IndexStack
impl Send for IndexStack
impl Sync for IndexStack
impl Unpin for IndexStack
impl UnsafeUnpin for IndexStack
impl UnwindSafe for IndexStack
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