[][src]Struct bracket::render::scope::Scope

pub struct Scope { /* fields omitted */ }

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

impl Scope[src]

pub fn new() -> Self[src]

Create a new scope.

pub fn locals(&self) -> &Value[src]

Get the underlying locals value.

pub fn set_local(&mut self, name: &str, value: Value)[src]

Set a named local variable.

The name does not need an @ prefix it is automatically prepended to the key.

pub fn local(&self, name: &str) -> Option<&Value>[src]

Get a named local.

Locals should have the @ prefix.

pub fn set_base_value(&mut self, value: Value)[src]

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.

pub fn base_value(&self) -> &Option<Value>[src]

Get the base value for this scope.

Trait Implementations

impl Clone for Scope[src]

impl Debug for Scope[src]

impl From<Map<String, Value>> for Scope[src]

Create a Scope from a locals map.

Auto Trait Implementations

impl RefUnwindSafe for Scope

impl Send for Scope

impl Sync for Scope

impl Unpin for Scope

impl UnwindSafe for Scope

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DynClone for T where
    T: Clone
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.