Struct liquid_interpreter::Stack
source · pub struct Stack<'g> { /* private fields */ }
Expand description
Stack of variables.
Implementations§
source§impl<'g> Stack<'g>
impl<'g> Stack<'g>
sourcepub fn with_globals(globals: &'g dyn Globals) -> Self
pub fn with_globals(globals: &'g dyn Globals) -> Self
Create a stack initialized with read-only Globals
.
sourcepub fn set_index<S>(&mut self, name: S, val: Value) -> Option<Value>where
S: Into<Cow<'static, str>>,
pub fn set_index<S>(&mut self, name: S, val: Value) -> Option<Value>where
S: Into<Cow<'static, str>>,
Used by increment and decrement tags
sourcepub fn get_index<'a>(&'a self, name: &str) -> Option<&'a Value>
pub fn get_index<'a>(&'a self, name: &str) -> Option<&'a Value>
Used by increment and decrement tags
sourcepub fn set_global<S>(&mut self, name: S, val: Value) -> Option<Value>where
S: Into<Cow<'static, str>>,
pub fn set_global<S>(&mut self, name: S, val: Value) -> Option<Value>where
S: Into<Cow<'static, str>>,
Sets a value in the global context.
sourcepub fn set<S>(&mut self, name: S, val: Value) -> Option<Value>where
S: Into<Cow<'static, str>>,
pub fn set<S>(&mut self, name: S, val: Value) -> Option<Value>where
S: Into<Cow<'static, str>>,
Sets a value to the rendering context. Note that it needs to be wrapped in a liquid::Value.
Panics
Panics if there is no frame on the local values stack. Context instances are created with a top-level stack frame in place, so this should never happen in a well-formed program.