pub struct UnitStack<P: ValueWidthPolicy> { /* private fields */ }Expand description
A bounded LIFO stack measured in policy-defined logical units.
Implementations§
Source§impl<P: ValueWidthPolicy> UnitStack<P>
impl<P: ValueWidthPolicy> UnitStack<P>
Sourcepub fn new(limit: WorkLimit) -> Self
pub fn new(limit: WorkLimit) -> Self
Creates an empty stack using the control organ’s work-limit vocabulary.
Sourcepub fn top(&self) -> Result<&P::Value, StackError>
pub fn top(&self) -> Result<&P::Value, StackError>
Returns the top value without removing it.
Sourcepub fn visit_values(&self, visit: impl FnMut(&P::Value))
pub fn visit_values(&self, visit: impl FnMut(&P::Value))
Visits operand values in deterministic bottom-to-top order.
Sourcepub fn push(&mut self, value: P::Value) -> Result<(), StackError>
pub fn push(&mut self, value: P::Value) -> Result<(), StackError>
Pushes a value if its complete logical width fits.
Sourcepub fn pop(&mut self) -> Result<P::Value, StackError>
pub fn pop(&mut self) -> Result<P::Value, StackError>
Pops the top value and releases all logical units it occupied.
Auto Trait Implementations§
impl<P> Freeze for UnitStack<P>
impl<P> RefUnwindSafe for UnitStack<P>
impl<P> Send for UnitStack<P>
impl<P> Sync for UnitStack<P>
impl<P> Unpin for UnitStack<P>
impl<P> UnsafeUnpin for UnitStack<P>
impl<P> UnwindSafe for UnitStack<P>
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