[−][src]Struct passerine::vm::stack::Stack
A stack of Tagged
Data
.
Note that in general the stack is expected to follow the following pattern:
FV...V...F V...T... ...
Or in other words, a frame followed by a block of n values that are locals followed by n temporaries, ad infinitum.
Fields
frames: Linked
stack: Vec<Tagged>
Implementations
impl Stack
[src]
pub fn init() -> Stack
[src]
Create a new Stack
with a single frame.
pub fn push_data(&mut self, data: Data)
[src]
Pushes some Data
onto the Stack
, tagging it along the way
pub fn push_tagged(&mut self, tagged: Tagged)
[src]
Pushes some Tagged
Data
onto the Stack
without unwrapping it.
pub fn pop_data(&mut self) -> Data
[src]
Pops some Data
of the Stack
, panicking if what it pops is not Data
.
Note that this will never return a Heaped
value, rather cloning the value inside.
pub fn pop_frame(&mut self)
[src]
Pops a stack frame from the Stack
, restoring the previous frame.
Panics if there are no frames left on the stack.
pub fn push_frame(&mut self)
[src]
Pushes a new stack frame onto the Stack
.
pub fn heapify(&mut self, index: usize)
[src]
Wraps the top data value on the stack in Data::Heaped
,
data must not already be on the heap
pub fn local_data(&mut self, index: usize) -> Data
[src]
pub fn set_local(&mut self, index: usize)
[src]
Sets a local - note that this function doesn't do much. It's a simple swap-and-drop. If a new local is being declared, it's literally a bounds-check and no-op.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Stack
impl Send for Stack
impl Sync for Stack
impl Unpin for Stack
impl UnwindSafe for Stack
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,