pub struct Stack { /* private fields */ }Expand description
Per-process call stack.
Implementations§
Source§impl Stack
impl Stack
Sourcepub const fn with_frame_limit(frame_limit: usize) -> Self
pub const fn with_frame_limit(frame_limit: usize) -> Self
Create an empty stack with a custom frame limit.
Sourcepub fn push_frame(
&mut self,
module: Atom,
ip: usize,
pinned_module: Arc<Module>,
y_slots: u16,
) -> Result<(), StackError>
pub fn push_frame( &mut self, module: Atom, ip: usize, pinned_module: Arc<Module>, y_slots: u16, ) -> Result<(), StackError>
Push a frame saving module:ip, pinning the caller module version, and allocating y_slots Y-registers.
Sourcepub fn pop_frame(&mut self) -> Result<ReturnPoint, StackError>
pub fn pop_frame(&mut self) -> Result<ReturnPoint, StackError>
Pop the current frame and return its saved return point.
Sourcepub fn current_frame(&self) -> Result<&StackFrame, StackError>
pub fn current_frame(&self) -> Result<&StackFrame, StackError>
Return the current frame.
Sourcepub fn current_frame_mut(&mut self) -> Result<&mut StackFrame, StackError>
pub fn current_frame_mut(&mut self) -> Result<&mut StackFrame, StackError>
Return the current frame mutably.
Sourcepub fn y_reg(&self, n: u16) -> Result<Term, StackError>
pub fn y_reg(&self, n: u16) -> Result<Term, StackError>
Read a Y-register from the current frame.
Sourcepub fn set_y_reg(&mut self, n: u16, value: Term) -> Result<(), StackError>
pub fn set_y_reg(&mut self, n: u16, value: Term) -> Result<(), StackError>
Write a Y-register in the current frame.
Sourcepub fn trim_y_regs(&mut self, remaining: u16) -> Result<(), StackError>
pub fn trim_y_regs(&mut self, remaining: u16) -> Result<(), StackError>
Shrink the current frame to remaining lowest-numbered Y-register slots.
Sourcepub const fn frame_limit(&self) -> usize
pub const fn frame_limit(&self) -> usize
Configured maximum frame count.
Sourcepub fn pinned_modules(&self) -> impl Iterator<Item = &Arc<Module>>
pub fn pinned_modules(&self) -> impl Iterator<Item = &Arc<Module>>
Iterator over every module version pinned by stack frames.
Sourcepub fn frames_from_top(&self) -> impl Iterator<Item = &StackFrame>
pub fn frames_from_top(&self) -> impl Iterator<Item = &StackFrame>
Iterator over call frames from newest to oldest.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Stack
impl RefUnwindSafe for Stack
impl Send for Stack
impl Sync for Stack
impl Unpin for Stack
impl UnsafeUnpin for Stack
impl UnwindSafe for Stack
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