pub struct Scope { /* private fields */ }Expand description
A scope encapsulates a base value (lookup object) used when
resolving variable paths and a collection of local variables
which are prefixed using the @ symbol.
Helpers can create scopes and push and pop them from the scope stack to create new variable evaluation contexts.
Implementations§
Source§impl Scope
impl Scope
Sourcepub fn set_local(&mut self, name: &str, value: Value)
pub fn set_local(&mut self, name: &str, value: Value)
Set a named local variable.
The name does not need an @ prefix it is automatically
prepended to the key.
Sourcepub fn local(&self, name: &str) -> Option<&Value>
pub fn local(&self, name: &str) -> Option<&Value>
Get a named local.
Locals should have the @ prefix.
Sourcepub fn set_base_value(&mut self, value: Value)
pub fn set_base_value(&mut self, value: Value)
Set the base value for the scope.
When the renderer resolves variables if they can be resolved using this value they are preferred over the root object.
Sourcepub fn base_value(&self) -> &Option<Value>
pub fn base_value(&self) -> &Option<Value>
Get the base value for this scope.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Scope
impl RefUnwindSafe for Scope
impl Send for Scope
impl Sync for Scope
impl Unpin for Scope
impl UnwindSafe for Scope
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