pub struct ContextStack { /* private fields */ }Expand description
Context stack for nested evaluations
Implementations§
Source§impl ContextStack
impl ContextStack
Sourcepub fn push(&mut self, data: Value)
pub fn push(&mut self, data: Value)
Pushes a new context frame for nested evaluation (data only).
Sourcepub fn push_with_index(&mut self, data: Value, index: usize)
pub fn push_with_index(&mut self, data: Value, index: usize)
Pushes a frame with just an index (optimized path for array iteration).
Sourcepub fn push_with_key_index(&mut self, data: Value, index: usize, key: String)
pub fn push_with_key_index(&mut self, data: Value, index: usize, key: String)
Pushes a frame with both index and key (optimized path for object iteration).
Sourcepub fn replace_top_key_data(&mut self, data: Value, index: usize, key: String)
pub fn replace_top_key_data(&mut self, data: Value, index: usize, key: String)
Replaces data, index, and key in the top frame in-place (for object iteration).
Sourcepub fn take_top_data(&mut self) -> Value
pub fn take_top_data(&mut self) -> Value
Takes the data from the top frame, replacing it with Null.
Sourcepub fn replace_top_data(&mut self, data: Value, index: usize)
pub fn replace_top_data(&mut self, data: Value, index: usize)
Replaces the data and index in the top frame in-place.
Sourcepub fn push_reduce(&mut self, current: Value, accumulator: Value)
pub fn push_reduce(&mut self, current: Value, accumulator: Value)
Pushes a reduce frame with “current” and “accumulator” values.
Sourcepub fn replace_reduce_data(&mut self, current: Value, accumulator: Value)
pub fn replace_reduce_data(&mut self, current: Value, accumulator: Value)
Replaces current and accumulator values in the top reduce frame in-place.
Sourcepub fn pop(&mut self) -> Option<ContextFrame>
pub fn pop(&mut self) -> Option<ContextFrame>
Pops the current context frame from the stack.
Sourcepub fn get_at_level(&self, level: isize) -> Option<ContextFrameRef<'_>>
pub fn get_at_level(&self, level: isize) -> Option<ContextFrameRef<'_>>
Accesses data at a context level relative to current.
§Arguments
level- The number of levels to traverse up the context stack- 0: returns the current context
- N (positive or negative): goes up N levels from current
Auto Trait Implementations§
impl Freeze for ContextStack
impl RefUnwindSafe for ContextStack
impl Send for ContextStack
impl Sync for ContextStack
impl Unpin for ContextStack
impl UnsafeUnpin for ContextStack
impl UnwindSafe for ContextStack
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